from math import gcd a, b = [int(x) for x in input().split()] x = gcd(a,b) if x == 1: print(1) else: print(0)