#include <bits/stdc++.h>
using namespace std;
int comparei4(const void* a, const void* b) {
  pair<pair<int, int>, pair<int, int> >
      *x = (pair<pair<int, int>, pair<int, int> >*)a,
     *y = (pair<pair<int, int>, pair<int, int> >*)b;
  if (x->second.first != y->second.first)
    return x->second.first - y->second.first;
  else {
    return y->second.second - x->second.second;
  }
}
int compareAscending(const void* a, const void* b) {
  return (*(int*)a - *(int*)b);
}
int compareDecending(const void* a, const void* b) {
  return (*(long long*)b > *(long long*)a ? 1 : 0);
}
int compareFirst(const void* a, const void* b) {
  if (((pair<int, int>*)a)->first == ((pair<int, int>*)b)->first)
    return ((pair<int, int>*)b)->second - ((pair<int, int>*)a)->second;
  else
    return ((pair<int, int>*)b)->first - ((pair<int, int>*)a)->first;
}
int compareSecond(const void* a, const void* b) {
  if (((pair<int, int>*)a)->second == ((pair<int, int>*)b)->second)
    return ((pair<int, int>*)a)->first - ((pair<int, int>*)b)->first;
  else
    return ((pair<int, int>*)a)->second - ((pair<int, int>*)b)->second;
}
class mycomparison {
  bool reverse;

 public:
  mycomparison(const bool& revparam = true) { reverse = revparam; }
  bool operator()(const pair<int, pair<int, int> >& lhs,
                  const pair<int, pair<int, int> >& rhs) const {
    if (reverse)
      return (lhs.first > rhs.first);
    else
      return (lhs.first < rhs.first);
  }
};
bool isPrime(int a) {
  if (a < 2) return false;
  if (a < 4) return true;
  if (a % 2 == 0) return false;
  int s = (int)sqrt(a);
  for (int i = 3; i <= s; i += 2) {
    if (a % i == 0) return false;
  }
  return true;
}
int bsearch(vector<int>* a, int value, int l, int r) {
  if (l == r) return l;
  if (l + 1 == r) return a[l][a[l].size() - 1] < value ? l : r;
  int m = (l + r) / 2;
  if (a[m][a[m].size() - 1] > value)
    return bsearch(a, value, m + 1, r);
  else
    return bsearch(a, value, l, m);
}
int ucln(int a, int b) {
  if (a % b == 0)
    return b;
  else
    return ucln(b, a % b);
}
int str2int(string str) {
  int res = 0;
  for (int i = 0; i < str.length(); i++) {
    res = res * 10 + str[i] - '0';
  }
  return res;
}
string rev(string a) {
  string res = "";
  for (int i = a.length() - 1; i >= 0; i--) res = res + a[i];
  return res;
}
int main() {
  string s1, s2;
  cin >> s1 >> s2;
  if (s1 == s2)
    cout << s1;
  else
    printf("1");
  return 0;
}
