#include <iostream> #include <algorithm> using namespace std; int a, b; int main(void) { cin >> a >> b; return printf("%d\n", __gcd(a, b)), 0; }