program abc;
var (a,b): integer;
begin
readln (a,b);
while a<>b do
if a=>b
yhen a:=b
then a:=a-b
else b:=b-a
end;
writeln (a)
end.
билет 17