A=input() B=input() for a in A+B: if "0"<=a<="9": True else: print("NG") exit() if A!="0" and A[0]=="0": print("NG") elif B!="0" and B[0]=="0": print("NG") else: if 0<=int(A)<=12345 and 0<=int(B)<=12345 : print("OK") else: print("NG")