#include <bits/stdc++.h>
using namespace std;
const int INF = numeric_limits<int>::max();
const long long LINF = numeric_limits<long long>::max();
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int MAXN = 1e5 + 7;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string a, b;
  cin >> a >> b;
  if (a == b)
    cout << a;
  else
    cout << 1;
  return 0;
}
