The penalty rule of the second kriiICPC is too complicated, so the organizers decided to hand the penalty computation to you.
Suppose you sent n submissions for one problem. The i-th submission (1≤i≤n) was sent ti minutes after the contest started and scored si points.
The penalty P for this problem is defined as follows. Let f be the smallest k with sk=max{s1,s2,…,sn}, that is, the index of the earliest submission among those with the highest score. Then P is:
Given the submissions you sent for one problem, write a program that computes the penalty you get on it.
The first line contains the number of submissions n (1≤n≤100).
Each of the next n lines contains two integers ti and si separated by a space. It is guaranteed that 1≤t1<t2<⋯<tn≤300, and each si is 0, 1, or 4.
Print the value of P on the first line.