from math import gcd A, B = map(int, input().split()) print(1 if gcd(A, B) == 1 else 0)