#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<cstdlib>
#include<numeric>
#include<set>
#include<utility>
#include<limits>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
using ll = long long;


template<class T>inline bool chmax(T& a, T b){if(a<b) { a=b;return true; } return false;}
template<class T>inline bool chmin(T& a, T b){if(a>b) { a=b;return true; } return false;}

const int MOD = 1000000007;


int main(){
	string s;cin >> s;
	if(s.size() == 1){
		if(s[0] == '8'){
			cout << "Yes" << endl;
			return 0;
		}else{
			cout << "No" << endl;
			return 0;
		}
	}
	vector<int> exist(10);
	for(int i=0;i<s.size();i++){
		int n = (int)(s[i] - '0');
		exist[n]++;
	}
	//rep(i,exist.size()){
	//	cout << "exist[" << i << "]は" << exist[i] << endl;
	//}
	bool flag = false;
	int i_start,i_end;
	if(s.size()==2){
		i_start=16;i_end=100;
	}else{
		i_start=104;i_end=1000;
	}
	for(int i=i_start;i<i_end;i+=8){
		int a,b,c;
		int i_copy = i;
		a = i_copy%10;i_copy/=10;
		b = i_copy%10;i_copy/=10;
		c = i_copy%10;i_copy/=10;
		//cout << "a b cは" << a << ' ' << b << ' ' << c << endl;
		vector<int> e_copy(exist.size());
		copy(exist.begin(),exist.end(),e_copy.begin());
		if(e_copy[a]>0){
			e_copy[a]--;
			if(e_copy[b]>0){
				e_copy[b]--;
				if(s.size() == 2){
					flag = true;
					break;
				}
				if(e_copy[c]>0){
					flag = true;
					break;
				}
			}
		}
	}
	if(flag) cout << "Yes" << endl; else cout << "No" << endl;
}

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


int main(){
    string S;
    int num;
    cin>>S;
    vector<int> count(10,0);
    vector<int> comp(10,0);
    for(int i=0;i<S.size();i++){
        count.at(S.at(i)-48)++;
    }
    if(S.size()==1){
        if(S.at(0)-48==8){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    else if(S.size()==2){
        if(((S.at(0)-48)*10+S.at(1)-48)%8==0||((S.at(1)-48)*10+S.at(0)-48)%8==0){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    else{
        for(int i=1;i<10;i++){
            comp.at(i)++;
            for(int j=1;j<10;j++){
                comp.at(j)++;
                for(int k=1;k<10;k++){
                    comp.at(k)++;
                    if(comp.at(k)>count.at(k)||comp.at(i)>count.at(i)||comp.at(j)>count.at(j)){
                        comp.at(k)--;
                        continue;
                    }
                    if((100*i+10*j+k)%8==0){
                        cout<<"Yes"<<endl;
                        return 0;
                    }
                    comp.at(k)--;
                }
                comp.at(j)--;
            }
            comp.at(i)--;
        }
    }
    cout<<"No"<<endl;
}