The input is a sequence of datasets. Each dataset is formatted as follows.
n
t1 c1
. . .
tn cn
n is an integer (1 <= n <= 50) that represents the number of swimmers. ti and ci are integers (1 <= ti <= 300, 1 <= ci <= 250) that represent the natural pace in times to swim from one end to the other and the number of planned laps for the i-th swimmer, respectively. ti and ci are separated by a space.
The end of the input is indicated by a line containing one zero.