Codeforces Round 306 (Div. 2)
C
Divisibility by Eight
Codeforces
1500
原题
← BD →
翻译中…

You are given a non-negative integer $*n*$, its decimal representation consists of at most $100$ digits and doesn't contain leading zeroes.

翻译中…

Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-negative integer, doesn't have leading zeroes and is divisible by 8. After the removing, it is forbidden to rearrange the digits.

翻译中…

If a solution exists, you should print it.

翻译中…

Input

翻译中…

The single line of the input contains a non-negative integer $*n*$. The representation of number $*n*$ doesn't contain any leading zeroes and its length doesn't exceed $100$ digits.

翻译中…

Output

翻译中…

Print "NO" (without quotes), if there is no such way to remove some digits from number $*n*$.

翻译中…

Otherwise, print "YES" in the first line and the resulting number after removing digits from number $*n*$ in the second line. The printed number must be divisible by $8$.

翻译中…

If there are multiple possible answers, you may print any of them.

翻译中…

样例

Input #1
3454
Output #1
YES
344
InputCopy OutputCopy
Input #2
10
Output #2
YES
0
InputCopy OutputCopy
Input #3
111111
Output #3
NO
InputCopy OutputCopy
题目信息
题号
550C
时间限制
2 s
内存限制
256 MB
标签
暴力
动态规划
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。