#include using namespace std; using ll = long long; int main(){ ll a, b; cin >> a >> b; ll ans = gcd(a, b); cout << ans << endl; return 0; }