var
a, b, c : longint;function nod3 (a, b, c :longint) : longint;
begin
nod3 := nod (nod (a, b), c);
end;function nod(var a, b: longint): longint;
begin
if (a = 0) or (b = 0) then
if a = 0 then
nod:= b
else
nod:= a
else
if a >= b then
nod:= nod( a mod b, b)
else
nod:= nod( a, b mod a)
end;begin
read (a, b, c);
writeln (nod3 (a, b, c));
end.