def isOK(s): return s=="0" or (s.isdecimal() and s[0]!='0') A=input() B=input() if isOK(A) and isOK(B): print('OK') else: print('NG')