1 /*
2 数学/暴力:只要一个数的最后三位能被8整除,那么它就是答案;用到sprintf把数字转移成字符读入
3 */
4 #include <cstdio>
5 #include <algorithm>
6 #include <cstring>
7 #include <iostream>
8 #include <cmath>
9 #include <vector>
10 using namespace std;
11
12 const int MAXN = 1e2 + 10;
13 const int INF = 0x3f3f3f3f;
14 char s[MAXN];
15 char t[MAXN];
16
17 int main(void) //Codeforces Round #306 (Div. 2) C. Divisibility by Eight
18 {
19 while (scanf ("%s", s) == 1)
20 {
21 bool ok = false;
22 for (int i=0; i<1000; ++i)
23 {
24 if (i % 8 == 0) sprintf (t, "%d", i);
25 int p = 0;
26 for (int i=0; s[i] && t[p]; ++i)
27 {
28 if (s[i] == t[p]) p++;
29 }
30 if (!t[p]) {puts ("YES"); printf ("%s\n", t); ok = true; break;}
31 }
32 if (!ok) puts ("NO");
33 }
34
35 return 0;
36 }
37
38 /*
39 3454
40 10
41 111111
42 */