#include<algorithm>
#include<bits/stdc++.h>
#include<map>
#include<queue>
#include<stack>
#include<set>
#include<vector>
#define ll long long
using namespace std;
#define i(x) (x+'0')
bool div8(string s)
{
int n=s.length(),ans=0;
if(n>=3)
for(int i=n-3,j=2;i<n;i++,j--)
ans+=(s[i]-'0')*pow(10,j);//,cout<<"ans: "<<ans<<endl;
else
for(int i=n-2,j=1;i<n;i++,j--)
ans+=(s[i]-'0')*pow(10,j);//,cout<<"ans: "<<ans<<endl;
if(ans%8==0)
return true;
else return false;
}
int main()
{
//freopen("ip.txt","r",stdin);
int fl,fl1,ans,pos;
string s;
string ch[]={"0","8","16","24","32","40","48","56","64","72","80","88","96","104","112","120","128","136","144","152","160","168","176","184","192","200","208","216","224","232","240","248","256","264","272","280","288","296","304","312","320","328","336","344","352","360","368","376","384","392","400","408","416","424","432","440","448","456","464","472","480","488","496","504","512","520","528","536","544","552","560","568","576","584","592","600","608","616","624","632","640","648","656","664","672","680","688","696","704","712","720","728","736","744","752","760","768","776","784","792","800","808","816","824","832","840","848","856","864","872","880","888","896","904","912","920","928","936","944","952","960","968","976","984","992"};
int size=sizeof(ch)/sizeof(string);
cin>>s;
int n=s.length();
if(n==1)
{
if(s=="8" || s=="0")
cout<<"YES\n"<<s<<endl;
else cout<<"NO\n";
}
else
{
if(div8(s))
{
cout<<"YES\n"<<s<<endl;
return 0;
}
fl=0;
pos=0;
for(int i=0;i<size;i++)
{
if(ch[i].length()>n)
{
fl=-1;
break;
}
else
{
int k=0;
fl1=0;
for(int j=0;j<ch[i].length();j++)
{
while(k<n)
{
if (s[k]==ch[i][j])
{
fl1++;
k++;
break;
}
k++;
}
if(k>=n && fl1<ch[i].length())
break;
}
if(fl1==ch[i].length())
{
pos=i;
fl=1;
break;
}
}
}
if(fl==0 || fl==-1)
cout<<"NO\n";
else if(fl==1)
{
cout<<"YES\n";
//cout<<"pos"<<pos<<endl;
cout<<ch[pos]<<endl;
}
}
return 0;
}
I2luY2x1ZGU8YWxnb3JpdGh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kbDsKICAgICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgfQogICAgICAgIGZsPTA7CiAgICAgICAgcG9zPTA7CiAgICAgICAgZm9yKGludCBpPTA7aTxzaXplO2krKykKICAgICAgICB7CiAgICAgICAgICAgIGlmKGNoW2ldLmxlbmd0aCgpPm4pCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGZsPS0xOwogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZWxzZSAKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaW50IGs9MDsKICAgICAgICAgICAgICAgIGZsMT0wOwogICAgICAgICAgICAgICAgZm9yKGludCBqPTA7ajxjaFtpXS5sZW5ndGgoKTtqKyspCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgd2hpbGUoazxuKQogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHNba109PWNoW2ldW2pdKQogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbDErKzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGsrKzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGsrKzsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaWYoaz49biAmJiBmbDE8Y2hbaV0ubGVuZ3RoKCkpCiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYoZmwxPT1jaFtpXS5sZW5ndGgoKSkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBwb3M9aTsKICAgICAgICAgICAgICAgICAgICBmbD0xOwogICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmKGZsPT0wIHx8IGZsPT0tMSkKICAgICAgICAgICAgY291dDw8Ik5PXG4iOwogICAgICAgIGVsc2UgaWYoZmw9PTEpCiAgICAgICAgewogICAgICAgICAgICBjb3V0PDwiWUVTXG4iOwogICAgICAgICAgICAvL2NvdXQ8PCJwb3MiPDxwb3M8PGVuZGw7CiAgICAgICAgICAgIGNvdXQ8PGNoW3Bvc108PGVuZGw7CiAgICAgICAgfQogICAgfQogICAgcmV0dXJuIDA7Cn0K