P1561 [USACO12JAN] Mountain Climbing S

Description

Farmer John has discovered that his cows produce higher quality milk when they are subject to strenuous exercise. He therefore decides to send his N cows (1

Input Format

Line 1: The number of cows, N. Lines 2..1+N: Line i+1 contains two space-separated integers: U(i) and D(i). (1

Output Format

Line 1: A single integer representing the least amount of time for all the cows to cross the mountain.