program main
  implicit none

  integer :: x, y, p

  read(*,*) x, y

  if(x == 1 .and. y == 1)then
     p = 400000
  else
     p = 0
  end if

  select case(x)
  case(1)
     p = p + 300000
  case(2)
     p = p + 200000
  case(3)
     p = p + 100000
  case default
     p = p
  end select

  select case(y)
  case(1)
     p = p + 300000
  case(2)
     p = p + 200000
  case(3)
     p = p + 100000
  case default
     p = p
  end select

  write(*,*) p

end program main

