import math x,y=map(int,input().split()) n=math.gcd(x,y) if n==1: print(1) else: print(0)