#include <bits/stdc++.h>
using namespace std;
const int mm = 2e5 + 10;
int a1, a2, a3, a4, a5, a6, a7, a8, a9, ans, ez1, n, m, k;
string s, s1;
int inp[4];
bool sos(const pair<int, int> &a, const pair<int, int> &b) {
  return (a.first > b.first);
}
void input() {
  cin >> s;
  cin >> s1;
}
void solve() {
  if (s == s1)
    cout << s << endl;
  else
    cout << 1 << endl;
}
int main() {
  cin.tie(0);
  input();
  solve();
  return 0;
}
