#include <bits/stdc++.h>
int main() {
  char ary1[102], ary2[102];
  scanf("%s%s", ary1, ary2);
  if (strcmp(ary1, ary2) == 0) {
    printf("%s\n", ary1);
  } else {
    printf("1\n");
  }
  return 0;
}
