var
a,b:longint;
begin
while not eof do begin
readln(a,b);
if (a<0) and (b<0) then exit;
if (abs(b-a))>50 then writeln(100-b-a)
else writeln((b-a));
end;
end.
var
a,b:longint;
begin
while not eof do begin
readln(a,b);
if (a<0) and (b<0) then exit;
if (abs(b-a))>50 then writeln(100-b+a)
else writeln((b-a));
end;
end.