from math import gcd print(int(gcd(*map(int,input().split()))==1))