#BS0000068. Vua bắn súng (Shooting King)

Vua bắn súng (Shooting King)

Shooting King

Source: AtCoder

Version: Phuoc Hung OJ Extended

Problem Statement

Balloon ii starts at height HiH_i and rises by SiS_i per second. One balloon can be shot at each integer time 0,1,2,…0,1,2,\ldots. Shooting balloon ii at time tt incurs penalty Hi+SitH_i+S_it. Minimize the maximum penalty.

Input

The first line contains NN. Each of the next NN lines contains Hi,SiH_i,S_i.

Output

Print the minimum possible score.

Subtasks

  • Subtask 1 — 20%: N≤50N\le50, Hi≤105H_i\le10^5, Si≤2000S_i\le2000.
  • Subtask 2 — 30%: N≤5000N\le5000.
  • Subtask 3 — 50%: N≤105N\le10^5, Hi,Si≤109H_i,S_i\le10^9.

Example

Input

4
5 6
12 4
14 7
21 2

Output

23

Explanation

Shooting in order 3,4,2,1 gives maximum penalty 23.