#include <bits/stdc++.h>
using namespace std;
void fast() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int main() {
  fast();
  string s1, s2;
  cin >> s1 >> s2;
  if (s1 == s2)
    cout << s1 << endl;
  else
    cout << 1 << endl;
  return 0;
}
