#include <bits/stdc++.h>
std::string calcGCD(std::string a, std::string b);
bool isZero(std::string str);
std::string substract(std::string a, std::string b);
int main() {
  std::string a, b;
  std::cin >> a >> b;
  if (a == b)
    std::cout << a << std::endl;
  else
    std::cout << 1 << std::endl;
  return 0;
}
std::string calcGCD(std::string a, std::string b) {
  std::cout << "calcGCD::" << a << ", " << b << std::endl;
  if (isZero(a)) return b;
  if (isZero(b)) return a;
  int shift = std::abs((int)a.size() - (int)b.size()) - 1;
  a = std::string(100 - (int)a.size(), '0') + a;
  b = std::string(100 - (int)b.size(), '0') + b;
  std::string bigger, smaller;
  bigger = std::max(a, b);
  smaller = std::min(a, b);
  if (shift > 0) {
    smaller = smaller.substr(shift, (int)smaller.size() - shift) +
              std::string(shift, '0');
  }
  while (bigger >= smaller) {
    bigger = substract(bigger, smaller);
  }
  if (shift > 0) {
    smaller = std::string(shift, '0') +
              smaller.substr(0, (int)smaller.size() - shift);
  }
  return calcGCD(smaller, bigger);
}
bool isZero(std::string str) {
  if (std::string((int)str.size(), '0') == str)
    return true;
  else
    return false;
}
std::string substract(std::string a, std::string b) {
  std::string ans(100, '0');
  int borrow = 0;
  for (int i = 100 - 1; i >= 0; i--) {
    ans.at(i) = a.at(i) - b.at(i) - borrow + '0';
    if (ans.at(i) < '0') {
      ans.at(i) += 10;
      borrow = 1;
    } else
      borrow = 0;
  }
  return ans;
}
