-- yukicoder My Practice -- author: Leonardone @ NEETSDKASU main = getContents >>= putStrLn . solve . words solve [a,b] = if check a && check b then "OK" else "NG" check xs@(x:_) | checkAllNum xs = let v = read xs in if x == '0' then v == 0 else v <= 12345 | otherwise = False checkAllNum [] = True checkAllNum (x:xs) | '0' <= x && x <= '9' = checkAllNum xs | otherwise = False