#include <bits/stdc++.h>
using namespace std;
char input1[1000], input2[1000];
int main() {
  while (scanf("%s%s", input1, input2) != EOF) {
    int i, j, length1 = strlen(input1), length2 = strlen(input2);
    if (length1 != length2)
      printf("%d\n", 1);
    else {
      for (i = 0; i < length1; i++) {
        if (input1[i] != input2[i]) break;
      }
      if (i == length1)
        printf("%s\n", input1);
      else
        printf("%d\n", 1);
    }
  }
  return 0;
}
