import math import sys input = sys.stdin.readline A, B = map(int, input().split()) G = math.gcd(A, B) if G==1: print(1) else: print(0)