Progress in artillery continues
At the upcoming meeting of the rearmament commission, another general spoke, advocating for technical innovations, including a new method of displaying numbers using segment indicators.
He explained that designers had enhanced the counting device, making it easier to detect display errors. According to him, the device now features a check indicator that shows the last digit of the sum of the digits of the displayed number. For instance, for the number 987, the check digit would be 4 (9+8+7=24, check digit - 4). Furthermore, to ensure greater reliability, these displays are crafted in the traditional manner, eliminating the possibility of distortion. The fact that designers initially dismissed this improvement as trivial and only implemented it after much persuasion was tactfully omitted by the innovative general.
The retrograde general immediately countered, arguing that this innovation does not prevent errors and used the number 17 as an example. With a single-segment error (i.e., when one necessary segment fails to light up or, conversely, one unnecessary segment lights up) in two digits, it can transform into 71, and the display of 8 on the check counter creates an illusion of correctness for the operator. If more than two digits are distorted, even more opportunities for errors arise.
You need to develop a program that, for a given number, determines whether such distortion is possible due to a display error of no more than one segment in each digit, where the check indicator does not reveal the error (distortions leading to the appearance of insignificant zeros or symbols that are not digits are not considered).
Input
The first line contains a non-negative integer N, which is being examined for the possibility of distortions, 0 ≤ N ≤ 10^1000.
Output
Output the word YES or NO depending on whether the described distortion is possible.