#include<bits/stdc++.h>
#include<string>

using namespace std;

#define ll long long int
#define ld long double
#define pb push_back
#define all(v) v.begin(),v.end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
#define deb(x) cout<< #x << '=' << x <<endl
#define MOD 1000000007

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    string s;
    cin>>s;
    int n = sz(s);
    for(int i = 104; i <= 1000; i += 8){
        string t = to_string(i);
        bool flag = 0;
        vector<int> vis(n , 0);
        for(int j = 0; j < sz(t); j++){
            bool ok = 0;
            for(int k = 0; k < n; k++){
                if(t[j] == s[k] && !vis[k]){
                    ok = 1;
                    vis[k] = 1;
                    break;
                }
            }
            if(!ok){
                flag = 1;
            }
        }
        if(!flag){
            cout<<"Yes\n";
            return 0;
        }
    }
    if(n == 2){   
        for(int i = 16; i <= 100; i += 8){
            string t = to_string(i);
            bool flag = 0;
            vector<int> vis(n , 0);
            for(int j = 0; j < sz(t); j++){
                bool ok = 0;
                for(int k = 0; k < n; k++){
                    if(t[j] == s[k] && !vis[k]){
                        ok = 1;
                        vis[k] = 1;
                        break;
                    }
                }
                if(!ok){
                    flag = 1;
                }
            }
            if(!flag){
                cout<<"Yes\n";
                return 0;
            }
        }
    }
    if(n == 1){
        if(s[0] == '8'){
            cout<<"Yes\n";
            return 0;
        }
    }
    cout<<"No\n";
    return 0;
}
#include <iostream>
#include <math.h>
#include <algorithm>
#include <queue>
#include <map>
#include <list>
//#include <bits/stdc++.h>


using namespace std;

#define FOR(i,a,b) for(int i=(a),i##formax=(b);i<i##formax;i++)
typedef long long ll;

bool solve(string s) {
    if(s.size() == 1) return s == "8";
    if(s.size() == 2){
        if(stoi(s) % 8 == 0) return 1;
        swap(s[0], s[1]);
        return stoi(s) % 8 == 0;
    }
    vector<int> cnt(10);
    FOR (i, 0, s.size()) {
        int si = s[i] - '0';
        cnt[si]++;
    }
    int lenofs = s.size();
    FOR (i, 13, 125) {
        vector<int> tmp = cnt;
        int a = 8 * i;
        string b = to_string(a);
        
        for (auto bi : b) {
            int bj = bi - '0';
            tmp[bj]--;
        }
        int cnt_less_than0 = 0;
        for (auto x : tmp) {
            if (x < 0) cnt_less_than0++;
        }
        if (cnt_less_than0 > 0)continue;
        else {
            return true;
        }
    }
    return false;
}



int main(){
    string s;
    cin >> s;
    string ans = solve(s) ? "Yes" : "No";
    cout << ans << endl;
    return 0;
}