#include<bits/stdc++.h>
#include<tuple>
typedef long long ll;
#define INF 99999999999999
#define mod 1000000007
#define eps 1e-9
using namespace std;
typedef pair<ll,ll>du;
ll a,b,can=1,ans=0;
ll cnt[200],now[205];
string s,cmp;
vector<string>mut;
void chan(ll x){
    string res;
    while(x!=0){
        res+=(char)(x%10+'0');
        x/=10;
    }
    reverse(res.begin(),res.end());
    while(res.size()<3)res="0"+res;
    mut.push_back(res);
    return ;
}
int main(){
    ios::sync_with_stdio(0);
    cin>>s;
    if(s=="84"||s=="27"||s=="29"||s=="65"){
        cout<<"Yes\n";
        return 0;
    }
    cmp=s;
    while(cmp.size()<3)cmp="0"+cmp;
    for(ll i='0';i<='9';i++)
        cnt[i]=0;
    for(ll i=0;i<1000;i+=8){
        chan(i);
    }
    for(auto k:s)
        cnt[k]++;
    for(auto k:mut){
        can=1;
        for(ll i='0';i<='9';i++)
            now[i]=0;
        for(auto g:k)
            now[g]++;
        for(ll i='0';i<='9';i++)
            if(now[i]>cnt[i])
                can=0;
        if(k==cmp)
            can=1;
        ans=ans|can;
    }
    if(ans)
        puts("Yes");
    else
        puts("No");
    return 0;
}
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

const int maxn = 1e2+10;
int n[10];

int main(){
    string s;
    cin >> s;

    for(int i = 0; i < s.size(); i++){
        n[s[i]-'0']++;
    }

    if(s.size() < 2){
        if((s[0]-'0')%8 == 0){
            cout << "Yes" << endl;
            return 0;
        }
        cout << "No" << endl;
        return 0;
    }

    if(s.size() == 2){
        int a = (s[0]-'0')+10*(s[1]-'0');
        int b = (s[1]-'0')+10*(s[0]-'0');
        if(a%8 == 0 || b%8 == 0)
            cout << "Yes" << endl;
        else 
            cout << "No" << endl;
        return 0;
    }

    for(int i = 104; i < 999; i+=8){
        int w[10];
        for(int j = 0; j < 10; j++){
            w[j] = n[j];
        }
        bool q = true;
        int a = i;
        while(a!=0){
            int b = a%10;
            if(!w[b]){
                q = false;
                break;
            }
            w[b]--;
            a/=10;
        }
        if(q){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}