#include <bits/stdc++.h>
using namespace std;
string text = "abcdefghijklmnopqrstuvwxyz";
const int maxn = 1e6 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string a, b;
  cin >> a >> b;
  if (a == b) {
    cout << a << endl;
  } else {
    cout << 1 << endl;
  }
}
