시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 188 15 10 12.658%

문제

n1부터 n5까지 총 5개의 정수를 입력합니다. 정수 n의 범위는 0 ≤ n ≤ 100 사이입니다. 그리고 입력된 4개의 정수(n1 부터 n4)를 가지고 산술 기호로 연산을 합니다.

이 때 산술 기호란 덧셈(+), 뺄셈(-), 곱셈(*), 나눗셈(/), 괄호('(',')')가 있으며 이 모든 연산자는 자유롭게 쓰일 순 있으나 산술 표현식에선 각 정수 사이에선 하나의 연산자만 사용 가능합니다.

이제 n1부터 n4까지 산술 기호로 자유롭게 연산하여 최종적으로 정답이 n5가 되는지 확인하는 프로그램을 작성하세요!

입력

입력 파일은 하나의 정수 데이터로 구성되어 있습니다. 각 데이터들은 5개의 요소로 이루어져 있으며, 모두 공백으로 분리되어 있습니다.

프로그램을 종료하기 위해 -1을 입력하면 프로그램을 종료하도록 해야합니다.

출력

각 정수 데이터들의 결과는 입력한 즉시 바로 입력한 줄에 출력하도록 하세요.

만약, n1부터 n4까지 연산했을 때 n5라는 결과가 나올 수 있다면 "OK!"를 출력합니다. 하지만 그렇지 못할 경우 "NO!"를 출력합니다.

예제 입력 1

1 2 3 4 50
2 3 10 1 61
-1

예제 출력 1

1 2 3 4 50 NO!
2 3 10 1 61 OK!
W3sicHJvYmxlbV9pZCI6Ijk4MTMiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWFjYzRcdWMwYjBcdWFlMzAiLCJkZXNjcmlwdGlvbiI6IjxwPm48c3ViPjE8XC9zdWI+XHViZDgwXHVkMTMwIG48c3ViPjU8XC9zdWI+XHVhZTRjXHVjOWMwIFx1Y2QxZCA1XHVhYzFjXHVjNzU4Jm5ic3A7XHVjODE1XHVjMjE4XHViOTdjIFx1Yzc4NVx1YjgyNVx1ZDU2OVx1YjJjOFx1YjJlNC4gXHVjODE1XHVjMjE4IG5cdWM3NTggXHViYzk0XHVjNzA0XHViMjk0IDAgJmxlOyBuICZsZTsgMT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