program t1(input,output);
var
n:integer;
a:double;
t,k:int64; max,i,j:longint;
data:array[1..2000000]of byte;
begin
assign(input,'light.in');
assign(output,'light.out');
reset(input);
rewrite(output);
readln(n); max:=0;
fillchar(data,sizeof(data),0);
for i:= 1 to n do
begin
readln(a,t);
for j:= 1 to t do
begin
k:=trunc(a*j);
data[k]:= (data[k]+1) mod 2 ;
if k > max then max:=k;
end;
end;
close(input);
for i:= 1 to max do
if data[i]=1 then
begin
writeln(i);
break;
end;
close(output);
end.