Under construction

Still being built. Things may change

Shopping Center

Time limit2sMemory limit1024 MB

Summary
Given n buses with departure times and travel durations, find the minimum of t_i plus l_i over all buses.
Level

Easy1 of 10

Topics
Implementation, Array
Solved
No attempts yet

Problem

Kendis wants to go to the shopping center to hang out with Jeremy. She checked the bus schedule and found that nn buses will leave from near their home toward the shopping center today. The ii-th bus will stop near their home tit_i minutes from now and takes lil_i minutes to travel from home to the shopping center. Find the earliest time Kendis can arrive at the shopping center.

Input

The first line contains one integer nn, the number of buses (1≤n≤1001 \le n \le 100). Each of the next nn lines contains two integers tit_i and lil_i: the number of minutes until the ii-th bus passes by Kendis's home, and the number of minutes the ii-th bus takes to travel from home to the shopping center (1≤ti,li≤1001 \le t_i, l_i \le 100).

Output

Print one integer, the minimum number of minutes after which Kendis can arrive at the shopping center.

Examples1

  1. Example 1

    Input
    3
    60 10
    30 50
    45 20
    
    Expected output
    65