#include<bits/stdc++.h>
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma comment(linker, "/stack:200000000")
using namespace std;
#define F first
#define S second
#define EB emplace_back
#define MP make_pair
#define all(o) (o).begin(), (o).end()
#define mset(m,v) memset(m,v,sizeof(m))
#define rep(i,n) for(ll i=0;i<(n);++i)
#define repe(i,a,b) for(ll i=a;i<=b;++i)
#define revlp(i,a,b) for(ll i=a;i>=b;i--)
#define remin(a,b) (a=min((a),(b)))
#define remax(a,b) (a=max((a),(b))) 
#define sz(x) (ll)(x).size()
#define endl '\n'
typedef long long ll;        typedef long double ld;
typedef pair<ll,ll> pi;     typedef vector<ll> vi;
typedef vector<pi> vpi;       typedef vector<vi> graph;
long long mod=1000000007;     long double EPS=1e-9;
#ifndef ONLINE_JUDGE
#define debarr(a,n)cerr<<#a<<":";for(int i=0;i<n;i++)cerr<<a[i]<<" ";cerr<<endl;
#define debmat(mat,row,col)cerr<<#mat<<":\n";for(int i=0;i<row;i++){for(int j=0;j<col;j++)cerr<<mat[i][j]<<" ";cerr<<endl;}
#define pr(...)dbs(#__VA_ARGS__,__VA_ARGS__)
template<class S,class T>ostream &operator<<(ostream &os,const pair<S,T> &p){return os<<"("<<p.first<<","<<p.second<<")";}
template<class T>ostream &operator<<(ostream &os,const vector<T> &p){os<<"[";for(auto&it:p)os<<it<<" ";return os<<"]";}
template<class T>ostream &operator<<(ostream &os,const set<T>&p){os<<"[";for(auto&it:p)os<<it<<" ";return os<<"]";}
template<class T>ostream &operator<<(ostream &os,const multiset<T>&p){os<<"[";for(auto&it:p)os<<it<<" ";return os<<"]";}
template<class S,class T>ostream &operator<<(ostream &os,const map<S,T>&p){os<<"[";for(auto&it:p)os<<it<<" ";return os<<"]";}
template<class T>void dbs(string str,T t){cerr<<str<<":"<<t<<"\n";}
template<class T,class...S>void dbs(string str,T t,S... s){int idx=str.find(',');cerr<<str.substr(0,idx)<<":"<<t<<",";dbs(str.substr(idx+1),s...);}
#else
#define pr(...){}
#define debarr(a,n){}
#define debmat(mat,row,col){}
#endif
 
bool check(string s){
    if(sz(s)==0)    return 1;
    string t=s;
    reverse(all(t));
    return s==t;
}
void solve(){
    string s;
    cin>>s;
    ll n=sz(s);
    ll i=n;
    while(i-1>=0 and s[i-1]=='0'){
        i--;
    }
    string rem=s.substr(0,i);
    if(check(rem)){
        cout<<"Yes"<<endl;
    }
    else cout<<"No"<<endl;
}
 
 
signed main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    //cout<<fixed<<setprecision(15);
    //clock_t begin = clock();
    ll tc=1;//cin>>tc;
    for(ll i=1;i<=tc;i++){
        //cout<<"Case #"<<i<<": ";
        solve();
    }
    // clock_t end = clock();double elapsed_secs = double(end - begin) / CLOCKS_PER_SEC;cerr << elapsed_secs;
}
#include<bits/stdc++.h>
#define endl '\n'
#define mod 1000000007
typedef long long int ll;
using namespace std;
#define MAX 100005
int arr[13];
string s;
vector<int> v;
void solve(int i)
{
    if(i==4)
    {
        int temp[13];
        for(int k=1;k<=9;k++) temp[k]=arr[k];
        for(auto k: v)
        {
            if(temp[k]==0) return ;
            temp[k]--;
        }
        ll no=v[0]*100+ v[1]*10 + v[2];
        if(no%8==0)  { cout<<"Yes"<<endl; exit(0); } 
        return ;
    }
    for(int  k=1;k<=9;k++){
        v.push_back(k);
        solve(i+1);
        v.pop_back();
    }
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin>>s;
    if(s.size()==1) {
        if(s[0]=='8') cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
        return 0;
    }
    if(s.size()==2)
    {
        int val=(s[0] - '0' )  *10  + (s[1]-'0') ;
        int fck=(s[1] - '0' )  *10  + (s[0]-'0') ;
        if(val%8==0 || fck%8==0) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
        return 0;
        
    }
    for(auto i: s)
    {
        arr[i-'0']++;
    }
    solve(1);
    cout<<"No"<<endl;
}