include algorithm include iostream include vector include cmath includ

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include <algorithm>
#include <iostream>
#include <vector>
#include <cmath>
#include <map>
using namespace std;
static int ar[130];
class fastio {
public:
fastio() {
ios_base::sync_with_stdio(false);
cout.tie(nullptr);
cin.tie(nullptr);
}
} __fastio;
int calculate() {
int k=0;
while(k < 126) {
ar[k] = k*8;
k++;
}
}
bool divisible(string str1, string str2, int m, int n) {
if(m == 0) return true;
if(n == 0) return false;
if(str1[m-1] == str2[n-1]) return divisible(str1, str2, m-1, n-1);
else return divisible(str1, str2, m, n-1);
}
void solve() {
string number;
cin >> number;
calculate();
for(int i=0; i<=124; i++) {
string a = to_string(ar[i]);
//string b = to_string(number);
string b = number;
//for(int i : ar)
//cout << i << ",";
//cout << "---" << b << endl;
if(divisible(a, b, a.length(), b.length())) {
cout << "YES" << endl;
cout << a << endl;
exit(0);
}
}
cout << "NO" << endl;
}
int main() {
__fastio;
solve();
return 0;
}