import java.util.*;
class Main
{
public static void main
(String[] args
) { Scanner in
= new Scanner
(System.
in); long n, m;
n = in.nextLong();
m = in.nextLong();
}
static long f(long n, long m) {
if (n % m == 0) return m;
if (m % n == 0) return n;
if (m > n) return f(m % n, n);
else return f(n % m , m);
}
}
aW1wb3J0IGphdmEudXRpbC4qOwogCmNsYXNzIE1haW4KewoJcHVibGljIHN0YXRpYyB2b2lkIG1haW4gKFN0cmluZ1tdIGFyZ3MpIHsKCQlTY2FubmVyIGluID0gbmV3IFNjYW5uZXIoU3lzdGVtLmluKTsKICAgIAkgICAgICAgIGxvbmcgbiwgbTsKICAgIAkgICAgICAgIG4gPSBpbi5uZXh0TG9uZygpOwogICAgCSAgICAgICAgbSA9IGluLm5leHRMb25nKCk7CiAgICAJICAgICAgICBTeXN0ZW0ub3V0LnByaW50KGYobiwgbSkpOwoJfQoJc3RhdGljIGxvbmcgZihsb25nIG4sIGxvbmcgbSkgewoJCWlmIChuICUgbSA9PSAwKSByZXR1cm4gbTsKCSAgICAgICAgaWYgKG0gJSBuID09IDApIHJldHVybiBuOwoJICAgICAgICBpZiAobSA+IG4pIHJldHVybiBmKG0gJSBuLCBuKTsKCSAgICAgICAgZWxzZSByZXR1cm4gZihuICUgbSAsIG0pOwoJfQp9