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