#include <bits/stdc++.h>
using namespace std;
int main() {
  long i, j, t, a, b, m, n, c, d, y, x, k, s;
  t = 1;
  while (t--) {
    string s1, s2;
    cin >> s1 >> s2;
    if (s1 == s2)
      cout << s1;
    else
      cout << 1;
  }
}
