#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int int_abs(int a, int b) {
  if (a >= b)
    return a - b;
  else
    return b - a;
}
int main() {
  int t = 1;
  while (t--) {
    string a, b;
    cin >> a >> b;
    if (a.size() != b.size()) {
      cout << 1;
      return 0;
    }
    bool f = 0;
    for (int i = 0; i < a.size(); i++) {
      if (a[i] != b[i]) {
        f = 1;
        break;
      }
    }
    if (f == 0) {
      cout << a;
      return 0;
    } else
      cout << 1;
  }
  return 0;
}
