Function NOK(A,B:integer):integer;
Begin
if A>B then result:=A-1
else result:=B-1;
repeat
result:=result+1
until (result mod A =0)and(result mod B = 0);
End;
Var
A,B:integer;
Begin
Write('A = ');ReadLn(A);
Write('B = ');ReadLn(B);
WriteLn(NOK(A,B));
End.