#include #include #include #include using namespace std; using ll = long long; #define rep(i,n) for(int i = 0; i < (int)(n); i++) #define all(c) begin(c), end(c) inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; } int main() { ll A, B; cin >> A >> B; cout << gcd(A + B, max(A, B)) << endl; return 0; }