def num(x): if x=="1": return 1 elif x=="2": return 1 elif x=="3": return 1 elif x=="4": return 1 elif x=="5": return 1 elif x=="6": return 1 elif x=="7": return 1 elif x=="8": return 1 elif x=="9": return 1 elif x=="0": return 1 else: return 0 def nuli (l): n=1 i=0 while n==1 and i < len(l): if num(l[i])==0: n=0 i+=1 if len(l)>1 and l[0]=="0": n=0 return n A=list(input()) B=input() #print(nuli(B)) if nuli (A)==0 or nuli(B)==0: print ("NG") else: Bi=int(B) if 0<=Bi and Bi<12346: print ("OK") else: print ("NG")