var a,b,buf,nok : longint;
begin
WriteLn('Введите a,b');
ReadLn(a,b);
nok:=a*b;
 while a<>b do
  begin
   if a<b then begin buf:=a; a:=b; b:=buf; end
   else a:=a mod b;
   WriteLn(a,b);
  end;
nok:=nok div a;
WriteLn('NOK of them is',nok );
ReadLn;
end.