Skip to main content
LIVE CONTEST: Round #7 · Begin Marathon is live now! …

~/algor $ cat problems/minmax/rectangle-with-the-largest-perimeter

Rectangle with the largest perimeter

Author Iqbolshoh Ilhomjonov 3 @iqbolshoh 650 problems
Easy 1000 ms 256 MB 22%
Share

A positive integer and the sides and of each of rectangles are given. Find the perimeter of the rectangle with the largest perimeter:

Choosing the rectangle with the largest perimeter among several

Input

The first line contains the number of rectangles . Each of the next lines contains two integers: and .

Output

One integer — the largest perimeter of a rectangle.

Note


Examples

Input #1
3
3 4
2 7
5 3
Output #1
18
Input #2
2
10 5
8 8
Output #2
32

Sign in to submit a solution

Signing up is free and takes a minute.