题目链接:http://codeforces.com/problemset/problem/550/C
//数学 枚举
//一个数字能不能被8整除取决于其后三位,后三位能被8整除那么这个数就能被8整除.
//于是我们只需要在字符串中取出三个数字,只要这三个数组成的数能被8整除,那么就是可行的答案.
#include<stdio.h>
#include<string>
#include<cstring>
#include<queue>
#include<algorithm>
#include<functional>
#include<vector>
#include<iomanip>
#include<math.h>
#include<iostream>
#include<sstream>
#include<set>
#include<climits>
#include<map>
#include<bitset>
using namespace std;
int main()
{
cin.sync_with_stdio(false);
char str[105];
cin>>str;
int len=strlen(str);
bool ok=false;
int Ans,n;
if (len>=3)
for (int i=0; i<len-2; i++)
{
if (str[i]=='0')
continue;
for (int j=i+1; j<len-1; j++)
{
for (int k=j+1; k<len; k++)
{
n=(str[i]-'0')*100+(str[j]-'0')*10+(str[k]-'0');
if (n%8==0)
{
ok=true;
Ans=n;
i=j=k=len;
}
}
}
}
if (!ok&&len>=2)
for (int i=0; i<len-1; i++)
{
if (str[i]=='0')
continue;
for (int j=i+1; j<len; j++)
{
n=(str[i]-'0')*10+(str[j]-'0');
if (n%8==0)
{
ok=true;
Ans=n;
i=j=len;
}
}
}
if (!ok&&len>=1)
for (int i=0; i<len; i++)
{
n=str[i]-'0';
if (n%8==0)
{
ok=true;
Ans=n;
i=len;
}
}
if (ok)
cout<<"YES"<<endl<<Ans;
else
cout<<"NO";
return 0;
}