#include <bits/stdc++.h>
using namespace std;

int main(){
    string S, numero;
    unordered_map<char,int> frequencia;
    int fator, tamanho, r;
    cin>>S;
    tamanho = S.size();
    if(tamanho==1){
        if(S[0]=='8'){
            printf("Yes");
        }
        else{
            printf("No");
        }
        return 0;
    }
    for(int i=0; i<tamanho; i++){
        frequencia[S[i]]++;
    }
    if(tamanho==2){
        numero.resize(2);
        for(int i=16; i<100; i+=8){
            fator=i;
            for(int j=1; j>-1; j--){
                numero[j] = ((char)(fator%10)+48);
                fator/=10;
            }
            //cout<<numero<<endl;
            for(int j=1; j>-1; j--){
                frequencia[numero[j]]--;
            }
            r=0;
            for(int j=1; j>-1; j--){
                if(frequencia[numero[j]]>=0){
                    r++;
                }
            }
            if(r==2){
                printf("Yes");
                return 0;
            }
            else{
                for(int j=1; j>-1; j--){
                    frequencia[numero[j]]++;
                }
            }
        }
        printf("No");
        return 0;
    }
    numero.resize(3);
    for(int i=104; i<1000; i+=8){
        fator=i;
        for(int j=2; j>-1; j--){
            numero[j] = ((char)(fator%10)+48);
            fator/=10;
        }
        //cout<<numero<<endl;
        for(int j=2; j>-1; j--){
            frequencia[numero[j]]--;
        }
        r=0;
        for(int j=2; j>-1; j--){
            if(frequencia[numero[j]]>=0){
                r++;
            }
        }
        if(r==3){
            printf("Yes");
            return 0;
        }
        else{
            for(int j=2; j>-1; j--){
                frequencia[numero[j]]++;
            }
        }
    }
    printf("No");
    return 0;
}
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)

int main() {
    string S; cin >> S;
    if (S.size() == 1) {
        if (S == "8" || S == "0") cout << "Yes" << endl;
        else cout << "No" << endl;
        return 0;
    }
    if (S.size() == 2) {
        ll a = (S[0] - 48)*10 + S[1] - 48;
        ll b = (S[1] - 48)*10 + S[0] - 48;
        if (a % 8 == 0 || b % 8 == 0) cout << "Yes" << endl;
        else cout << "No" << endl;
        return 0;
    }

    vector<ll> cnt(10, 0);
    for (int i : S) {
        if (cnt[i - 48] < 3) ++cnt[i - 48];
    }
    bool flg = (S.size() == 3);
    
    for (ll i = (flg); i < 10; i++) {
        if (cnt[i] == 0) continue;
        --cnt[i];
        for (ll j = 0; j < 10; j++) {
            if (cnt[j] == 0) continue;
            --cnt[j];
            for (ll k = 0; k < 10; k++) {
                if (cnt[k] == 0) continue;
                ll num = 100*i + 10*j + k;
                if (num % 8 == 0) {
                    cout << "Yes" << endl;
                    return 0;
                }
            }
            ++cnt[j];
        }
        ++cnt[i];
    }
    cout << "No" << endl;
}