#!/usr/bin/env python3

# https://codeforces.com/problemset/problem/664/A

a,b = input().split()
print(a if a==b else 1)

#!/usr/bin/env python3

# https://codeforces.com/problemset/problem/664/A

a,b = input().split()
print(a if a==b else 1)

#!/usr/bin/env python3 # https://codeforces.com/problemset/problem/664/A