program my; const max = 2550; type long = record sign : char; len : word; number : array[1..max+1] of shortint; end; var a,b,c,r,x,y : long; i,n,res : longint; procedure input(var x : long); var i : word; s : char; begin if (s>='0') and (s<='9') then begin read(s); x.sign := '+'; x.len := 1; x.number[1] := ord(s)-ord('0'); end; while not eoln do begin read(s); if (s>='0') and (s<='9') then begin inc(x.len); x.number[x.len] := ord(s)-ord('0'); end; end; for i := x.len downto 1 do x.number[max-x.len+i] := x.number[i]; for i := 1 to max-x.len do x.number[i] := 0; readln; end; procedure output(const x: long); var i : word; begin for i := max-x.len+1 to max do write(x.number[i]); writeln; end; function comp_abs(const a,b : long) : shortint; var i : word; res : shortint; begin {// a.number[max+1] := 1; b.number[max+1] := 2;} i := 1; while (i <= max) and (a.number[i] = b.number[i]) do inc(i); if i>max then res := 0 else if a.number[i] =b.len then for p := max-a.len+b.len to max do begin rest.len := longLen(rest); while comp_abs(rest,b)>=0 do begin minus_abs(rest,b,rest); end; if p=b.len then for p := max-a.len+b.len to max do begin s := 0; rest.len := longLen(rest); while comp_abs(rest,b)>=0 do begin minus_abs(rest,b,rest); inc(s); end; shift(quot,1); quot.number[max] := s; if p true) and (comp_0(b) <> true) do begin if comp_abs(a,b)>0 then begin div_mod(a,b,X); a := X; end else begin div_mod(b,a,X); b := X; end; end; plus_abs(a,b,c); end; begin input(x); input(y); if (longLen(x)>=2550) or (longLen(y)>=2550) then writeln(0) else begin _gcd(x,y,a); output(a); end; end.