import std.stdio, std.string, std.array, std.conv;

int arrayGCD(int[] x) {
    while (x.length > 1) {
        int a = x[0] < x[1] ? x[1] : x[0];
        int b = x[0] < x[1] ? x[0] : x[1];
        int r;
        while (b > 0) {
            r = a % b;
            a = b;
            b = r;
        }
        x[1] = a;
        x = x[1..$];
    }
    return x[0];
}

void main() {
    int[] a = readln.chomp.split.to!(int[]);
    arrayGCD(a).writeln;
}
