#include <bits/stdc++.h>
using namespace std;
long long n, ar[500005 + 5];
int main() {
  long long i, j, k, x, y;
  string a, b;
  cin >> a >> b;
  if (a == b)
    cout << a << endl;
  else
    cout << 1 << endl;
}
