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

        #define ll long long
        #define pb push_back
        #define printV(v) for(int i=0;i<(int)v.size();i++){cout << v[i]<< " ";} cout << endl
        #define printRev(v) for(int i=(int)v.size()-1;i >= 0;i--){cout << v[i] << " ";} cout << endl
        #define sortV(v) sort(v.begin(),v.end())
        #define revV(v) reverse(v.begin(),v.end())
    

        ll a,b,c,d,e,f,g,n,m,k,t,x,h,w,p,q,y;
        string str = "";
        ll mod = 1e9 + 7;
        const int N = 100009;

       
        void solve(){
            cin >> str;
            if(str.size() < 4){
                n = stoi(str); 
                if(n%8 == 0){
                    cout << "Yes\n";
                    return;
                }
                if(str.size() == 2){
                    string newOne = str;
                    newOne[0] = str[1];
                    newOne[1] = str[0];
                    n = stoi(newOne);
                    if(n%8 == 0){
                        cout << "Yes\n";
                        return;
                    }
                }
            }
            
            map<char,int> mp;
            for(char ch : str){
                mp[ch]++;
            }
            
            for(int i=104; i < 1000; i+= 8){
                string str = to_string(i);
                map<char, int> curr;
                for(char ch : str) curr[ch]++;
                bool flag = true;
                for(auto it : curr){
                    char ch = it.first;
                    int amount = it.second;
                    int amount2 = mp[ch];
                    if(amount > amount2) flag = false;
                }
                if(flag){
                    cout << "Yes\n";
                    return;
                }
            }
            cout << "No\n";
            
        }
       


        



       
        


        int main(){
            ios_base::sync_with_stdio(false);

         

            int cases = 1;
            //cin >> cases;

            while(cases--) solve();
            return 0;

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

#define debug(x) cout << #x << ": " << (x) << endl;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> iip;

string s;
int cnt[10] = {0};

bool check(int last_digit) {
    // debug(last_digit);

    if (!cnt[last_digit]) return false;

    --cnt[last_digit];

    int i;
    if (last_digit == 8) i = 0;
    else if (last_digit == 6) i = 1;
    else if (last_digit == 4) i = 2;
    else if (last_digit == 2) i = 3;

    for (; i < 100; i += 4) {
        if (s.length() > 2 && i < 10) continue;

        vector<int> v(cnt, cnt + 10);

        bool f = true;
        string s = to_string(i);
        // debug(s);
        for (auto c : s) {
            // if (c == '0') continue;

            if (!v[c - '0']) {
                f = false;
                break;
            }

            --v[c - '0'];
        }

        if (f) return true;
    }

    ++cnt[last_digit];
    return false;
} 

void solve() {
    // string s;
    cin >> s;

    if (s == "8") {
        cout << "Yes\n";
        return;
    }

    for (auto c : s) {
        ++cnt[c - '0'];
    }

    if (check(8) || check(6) || check(4) || check(2)) cout << "Yes\n";
    else cout << "No\n";
}

int main() {
    // For fast I/O
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int T = 1;
    // cin >> T;
    while (T--) {
        solve();
    }

    return 0;
}