#include <bits/stdc++.h>
using namespace std;
int main() {
  string s1, s2;
  cin >> s1 >> s2;
  string ans = "";
  if (s1 == s2)
    ans = s1;
  else
    ans = "1";
  cout << ans << "\n";
  return 0;
}
