function gcd(input) {
    var x = +input.split(" ")[0];
    var y = +input.split(" ")[1];
    function _gcd(x, y) {
        if (x == y) {
            return x;
        }
        else if (x < y) {
            function swap(x, y) {
                var tmp = x;
                x = y;
                y = tmp;
            }
            swap(x, y);
        }
        if (y == 0) {
            return x;
        }
        return _gcd(y, x % y);
    }
    return _gcd(x, y);
}

console.log(gcd(require("fs").readFileSync("/dev/stdin", "UTF-8")));

