program xxxx;
var f:array[1..2000000] of boolean;
n,i,j,ti:longint;
ai:real;
begin
assign(input,'light.in');
reset(input);
assign(output,'light.out');
rewrite(output);
read(n);
for i:=1 to 2000000 do
f[i]:=false;
for i:=1 to n do
begin
read(ai,ti);
for j:=1 to ti do
if f[trunc(ai*j)] then
f[trunc(ai*j)]:=false
else
f[trunc(ai*j)]:=true;
end;
for i:=1 to 2000000 do
if f[i] then
begin
write(i);
break;
end;
close(input);
close(output);
end.