program contest
implicit none
integer :: x, y, c
integer :: money(205)

money(1) = 300000
money(2) = 200000
money(3) = 100000
money(4:205) = 0

read(*,*) x, y
if (x>4 .and. y>4) then
write(*,*) 0
stop
end if

c = money(x)+money(y)

if(x==1 .and. y==1) then
c = c + 400000
end if
write(*,*) c

end program contest