#include <iostream>
using namespace std;


int gcd4(int a, int b, int c, int d);


int main() {
    int a, b, c, d;
    while (cin >> a >> b >> c >> d) {
        cout << gcd4(a, b, c, d) << endl;
    }
    return 0;
}
