#include <bits/stdc++.h>
const long long INF = 0x3f3f3f3f3f3f3f;
const long long NINF = -INF - 1;
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  string s1, s2;
  cin >> s1 >> s2;
  if (s1 == s2)
    cout << s1 << endl;
  else
    cout << "1" << endl;
  return 0;
}
