program light(input,output);
var
i,i1,j,k,n,t1,z1:longint;
z:real;
a:array[1..10000000] of real;
b:array[1..10000000] of boolean;
c:array[1..1000] of integer;
t:array[1..10000000] of integer;
function change(z:real):longint;
var i1:longint;
begin
i1:=0;
while i1<z do inc(i1);
change:=i1;
end;{change}
begin
assign(input,'light.in');
reset(input);
assign(output,'light.out');
rewrite(output);
readln(n);
for i :=1 to n do
readln(a[i],t[i]);
close(input);
k:=1;
for i:=1 to n do writeln(a[i],' ',t[i]);
fillchar(b,sizeof(b),false);
for i:=1 to n do begin
for j:=1 to t[i] do begin
z:=int(a[i]*j);
z1:=change(z);
write('deng---->',z1,' ');
if z1>k then k:=z1;
b[z1]:=not(b[z1]);
for i1:=1 to k do write(b[i1]:8);
writeln;
end;
end;{doit}
t1:=0;
for i:=1 to k do
if b[i] then begin
t1:=t1+1;
c[t1]:=i;
end;
for i:=1 to t1 do writeln(c[i]);
close(output);
end.