#include <bits/stdc++.h>
using namespace std;
#define FASTIO cin.tie(0);ios::sync_with_stdio(0)

int main() {
	FASTIO;
	string n;
	cin >> n;
	map<char, int> ava;
	for (int i = 0; i < n.size(); i++) {
		ava[n[i]]++;
	}
	if (n.size() >= 3) {
		for (int i = 104; i < 1000; i+=8) {
			string mystring = to_string(i);
			int c = 0;
			map<char, int> need;
			for (char i : mystring) {
				need[i]++;
			}
			for (auto pair : need) {
				if (ava[pair.first] >= pair.second) {
					c += pair.second;
				}
			}
			if (c == 3) {
				cout << "Yes" << "\n";
				return 0;
			}
		}
		cout << "No" << "\n";
	} else if (n.size() == 2) {
		for (int i = 16; i < 100; i+=8) {
			string mystring = to_string(i);
			int c = 0;
			map<char, int> need;
			for (char i : mystring) {
				need[i]++;
			}
			for (auto pair : need) {
				if (ava[pair.first] >= pair.second) {
					c += pair.second;
				}
			}
			if (c == 2) {
				cout << "Yes" << "\n";
				return 0;
			}
		}
		cout << "No" << "\n";
	} else {
		if (ava['8'] == 1) {
			cout << "Yes" << "\n";
			return 0;
		} else {
			cout << "No" << "\n";
			return 0;
		}
	}
}

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    string s;
    cin >> s;

    vector<int> cnt(10);
    int n = s.size();

    if(n == 1){
        if(s == "8") cout << "Yes" << endl;
        else cout << "No" << endl;
        return 0;
    }

    if(n == 2){
        int num = (s[0]-'0')*10 + s[1];
        if(num % 8 == 0){
            cout << "Yes" << endl;
            return 0;
        }
        num = (s[1]-'0')*10 + s[0];
        if(num % 8 == 0){
            cout << "Yes" << endl;
            return 0;
        }
        cout << "No" << endl;
        return 0;
    }

    rep(i,n){
        cnt[s[i]-'0']++;
    }

    rep(i,10){
        rep(j,10){
            rep(k,10){
                if(!i || !j || !k) continue;
                vector<int> c = cnt;
                c[i]--, c[j]--, c[k]--;
                bool flag = false;
                rep(l,10){
                    if(c[l] < 0)flag = true;
                }
                if(flag) continue;

                int num = i*100 + j*10 + k;
                if(num % 8 == 0){
                    cout << "Yes" << endl;
                    return 0;
                }
            }
        }
    }
    cout << "No" << endl;
}