#include <iostream>
#include <string>
#include <utility>
#include <vector>
using namespace std;

int main() {
    string s; cin >> s;
    bool flag = false;

    if (s.size() == 1) {
        if (s == "8") flag = true;
    }
    else if (s.size() == 2) {
        if (stoi(s) % 8 == 0) flag = true;
        swap(s[0], s[1]);
        if (stoi(s) % 8 == 0) flag = true;
    }
    else {
        vector<int> cnt(10);
        for (int i = 0; i < (int)s.size(); ++i) {
            cnt[s[i] - '0']++;
        }
        for (int i = 112; i < 1000; i += 8) {
            vector<int> check = cnt;
            string n = to_string(i);
            for (int j = 0; j < 3; ++j) {
                check[n[j] - '0']--;
            }
            if (check[n[0] - '0'] >= 0 && check[n[1] - '0'] >= 0 && check[n[2]- '0'] >= 0) {
                flag = true;
            }
        }
    }

    if (flag) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<iomanip>
#include<algorithm>
#include<utility>
#include<set>
#include<map>
#include<queue>
#include<complex>

#define Debug cout<<"line: "<<__LINE__<<"Debug"<<endl;
#define Yes cout<<"Yes"<<endl;
#define YES cout<<"YES"<<endl;
#define No cout<<"No"<<endl;
#define NO cout<<"NO"<<endl;
#define ALL(a) (a).begin(),(a).end()
#define MOD 1000000007
#define PI 3.14159265358979323846

using namespace std;

using ll = long long;
using ld = long double;
using vi = vector<int>;
using vd = vector<double>;
using vl = vector<long long>;

void set_FPD(int n){ cout<<fixed<<setprecision(n); return; }

void Main(){
    string s;
    cin>>s;
    vi num(10,0);
    int size=s.size();
    for(char &x:s) num[x-'0']++;
    if(size<3){
        if(size<2) num[0]+=2;
        else num[0]++;
    }
    for(int i=0;i<10;i++){
        if(size<3 && i>0) continue;
        for(int j=0;j<10;j++){
            if(size<2 && j>0) continue;
            for(int k=0;k<10;k++){
                vi cnt(10,0);
                cnt[i]++;
                cnt[j]++;
                cnt[k]++;
                int n=100*i+10*j+k;
                if(n%8==0 && cnt[i]<=num[i] && cnt[j]<=num[j] && cnt[k]<=num[k]){
                    //cout<<n<<endl;
                    Yes
                    return;
                }
            }
        }
    }
    No
    return;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    Main();
    return 0;
}
