#include <bits/stdc++.h>
const long long M = 1e12;
const long long N = 1e5 + 5;
using namespace std;
long long max(long long a, long long b) {
  if (a >= b)
    return a;
  else
    return b;
}
long long min(long long a, long long b) {
  if (a <= b)
    return a;
  else
    return b;
}
long long diff(long long a, long long b) {
  if (a >= b)
    return a - b;
  else
    return b - a;
}
long long isPrime(long long n) {
  if (n < 2) return 0;
  if (n < 4) return 1;
  if (n % 2 == 0 or n % 3 == 0) return 0;
  for (long long i = 5; i * i <= n; i += 6)
    if (n % i == 0 or n % (i + 2) == 0) return 0;
  return 1;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
void sort(long long arr[], long long n) {
  for (long long i = 0; i <= n; i++) {
    for (long long j = i; j <= n; j++) {
      if (arr[i] > arr[j]) {
        long long t = arr[i];
        arr[i] = arr[j];
        arr[j] = t;
      }
    }
  }
}
long long modd(long long n, long long m) {
  if (n - m > 0) {
    return n - m;
  } else {
    return m - n;
  }
}
long long fact(long long n) {
  if (n == 1) {
    return 1;
  } else {
    return n * fact(n - 1);
  }
}
long long mod(long long n) {
  if (n >= 0) {
    return n;
  } else {
    return -n;
  }
}
long long isperfectsquare(long long n) {
  long long k = sqrt(n);
  if (n % k == 0 && n / k == k) {
    return 1;
  } else {
    return 0;
  }
}
void pairsort(long long a[], long long b[], long long n) {
  pair<long long, long long> pairt[n];
  for (long long i = 0; i < n; i++) {
    pairt[i].first = a[i];
    pairt[i].second = b[i];
  }
  sort(pairt, pairt + n);
  for (long long i = 0; i < n; i++) {
    a[i] = pairt[i].first;
    b[i] = pairt[i].second;
  }
}
long long ispalindrome(string s) {
  long long palindrome = 1;
  long long n = s.length();
  for (long long i = 0; i < (n / 2); i++) {
    if (s[i] != s[n - 1 - i]) {
      palindrome = 0;
      break;
    }
  }
  return palindrome;
}
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
string longsum(string n1, string n2) {
  string s1 = "";
  string s2 = "";
  long long carry = 0;
  long long n = min(n1.length(), n2.length());
  if (n1.length() != n2.length()) {
    if (n1.length() == n) {
      long long diff = n2.length() - n;
      while (diff--) {
        s2 += '0';
      }
      for (long long i = 0; i < n1.length(); i++) {
        s2 += n1[i];
      }
      n1 = s2;
      s2 = "";
    } else {
      long long diff = n1.length() - n;
      while (diff--) {
        s2 += '0';
      }
      for (long long i = 0; i < n2.length(); i++) {
        s2 += n2[i];
      }
      n2 = s2;
      s2 = "";
    }
  }
  long long length = max(n1.length(), n2.length());
  for (long long i = length - 1; i >= 0; i--) {
    long long sum = n1[i] - 48 + n2[i] - 48 + carry;
    carry = sum / 10;
    s1 += (sum % 10) + 48;
  }
  if (carry) {
    s2 += (carry + 48);
  }
  for (long long i = 0; i < length; i++) {
    s2 += s1[length - i - 1];
  }
  return s2;
}
long long lcompstr(string s1, string s2) {
  if (s1.length() != s2.length()) {
    if (s1.length() > s2.length()) {
      return 1;
    } else {
      return 0;
    }
  } else {
    for (long long i = 0; i < s1.length(); i++) {
      if (s1[i] > s2[i]) {
        return 1;
      } else if (s1[i] < s2[i]) {
        return 0;
      }
    }
  }
  return 1;
}
long long gcdExtended(long long a, long long b, long long *x, long long *y) {
  if (a == 0) {
    *x = 0, *y = 1;
    return b;
  }
  long long x1, y1;
  long long gcd = gcdExtended(b % a, a, &x1, &y1);
  *x = y1 - (b / a) * x1;
  *y = x1;
  return gcd;
}
long long modInverse(long long a, long long m) {
  long long x, y;
  long long g = gcdExtended(a, m, &x, &y);
  if (g != 1) cout << "Inverse doesn't exist";
  long long res = (x % m + m) % m;
  return res;
}
void add1(long long &a, long long b) {
  a = a + b;
  if (a >= 1000000007) {
    a = a - 1000000007;
  }
}
long long idb(long long i, long long j, long long k) {
  long long num = i * 100 + j * 10 + k;
  if (num % 8 == 0) {
    return 1;
  } else {
    return 0;
  }
}
long long isdiv(long long n, long long k) {
  while (n % k == 0) {
    n /= k;
  }
  if (n == 1) {
    return 1;
  } else {
    return 0;
  }
}
vector<long long> adder(long long n) {
  vector<long long> v;
  if (n == 1) {
    v.push_back(1);
  } else if (n == 2) {
    v.push_back(1);
    v.push_back(2);
  } else if (n == 3) {
    v.push_back(1);
    v.push_back(1);
    v.push_back(3);
  } else {
    long long t = (n % 2) + (n / 2);
    while (t--) {
      v.push_back(1);
    }
    vector<long long> v1;
    v1 = adder(n / 2);
    for (long long i = 0; i < v1.size(); i++) {
      v.push_back(2 * v1[i]);
    }
  }
  return v;
}
int32_t main() {
  string a, b;
  cin >> a >> b;
  if (a == b) {
    cout << a << endl;
    return 0;
  }
  cout << 1 << endl;
  return 0;
}
