program different_distribution
  implicit none
  integer :: n, a, b, ma, mb, i
  ma = 0
  mb = 0
  read(*,*) n
  do i = 1, n
    read(*,*) a, b
    if (ma.lt.a) then
      ma = a
      mb = b
    end if
  end do
  write(*,'(i0)') ma+mb
  stop
end program different_distribution