from math import gcd A, B = [int(s) for s in input().split()] print(1 if gcd(A, B) == 1 else 0)