program disco
  implicit none

  integer :: x, y, p

  read(*,*) x, y

  p = 0
  
  if( x == 1 ) then
     p = 300000
  else if( x == 2 ) then
     p = 200000
  else if( x == 3 ) then
     p = 100000
  end if

  if( y == 1 ) then
     p = p + 300000
  else if( y == 2 ) then
     p = p + 200000
  else if( y == 3 ) then
     p = p + 100000
  end if

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

  write(*,*) p
  
  stop
end program disco
