#include <bits/stdc++.h>

using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define ll long long int
#define INF 1000000007
#define llINF 1000000000000000007
#define v(i) vector<i>
#define vv(i) vector<vector<i>>
// int num = atoi(string.c_str()); 文字列の整数変換
int keta(ll n){int ans=0;while(n>0){n /= 10; ans++;}return ans;}
ll _pow(ll a,ll b){ll ans = 1;rep(i,b){ ans *= a;}return ans;}




int main() {
string a;cin>>a;
map<int,int> m;
vector<int> v;
rep(i,a.size()){
   int cnt = a[i] - '0';
   m[cnt]++;
   v.push_back(cnt);
}
bool flag = false;
if(v.size() == 1){
if(v[0] == 8)flag = true;
}
else if(v.size() == 2){
   if((v[0]*10+v[1])%8==0 || (v[1]*10+v[0])%8==0)flag = true;
}
else{
   rep(i,10){
   rep(j,10){
      rep(k,10){
         map<int,int>M;
         M[i]++;M[j]++;M[k]++;
         int cnt = i*100 +j*10 +k;
         if(cnt % 8 !=0 || cnt == 0) continue;
         if(M[i]<=m[i]&&M[j]<=m[j]&&M[k]<=m[k]) flag = true;
      }
   }
}

}
if(flag){
   cout<<"Yes"<<endl;
}else{
   cout<<"No"<<endl;
}
return 0;
   }

#include<bits/stdc++.h>
#include <iterator>
#include <iostream>
#include <numeric>
#include <math.h>
#define ll long long
#define ull long
#define mpa make_pair
#define pb push_back
#define ff first
#define pii pair<ll,ll>
#define dd double
#define trace(x) cerr << #x << " : " << x << endl
#define ss second
#define boost ios_base::sync_with_stdio(0)
#define forp(i,a,b) for(ll i=a;i<=b;i++)
#define rep(i,n)    for(ll i=0;i<n;++i)
#define ren(i,n)    for(ll i=n-1;i>=0;i--)
#define forn(i,a,b) for(ll i=a;i>=b;i--)
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c).begin()) i = (c).begin(); i != (c).end();
#define sc(x) scanf("%lld",&x)
#define clr(x,val) memset(x,val,sizeof(x))
#define pr(x) printf("%lld\n",x) 
#define gc getchar
#define pdd pair<dd,dd>
#define read_arr(a,n) for(ll i=1;i<=n;i++)cin>>a[i];
#define init_arr(a,n) for(ll i=1;i<=n;i++)a[i]=n-i+1;
#define prec(x) cout<<fixed<<setprecision(x)
#define fre freopen("input.txt","r",stdin),freopen("output.txt","w",stdout)
#define arr array 
using namespace std;

int main() {
	string s;
	cin>>s;
	ll n=s.size();
	
	if(n==1){
		ll num=s[0]-'0';
		if(num%8)cout<<"No";
		else cout<<"Yes";
		return 0;
	}
	
	if(n==2){
		ll num=(s[0]-'0')*10+(s[1]-'0');
		if(num%8==0){
			cout<<"Yes";
			return 0;
		}
		
		num=(s[1]-'0')*10+(s[0]-'0');
		
		if(num%8==0){
			cout<<"Yes";
			return 0;
		}
		
		cout<<"No";
		return 0;
	}
	
	map<char,ll> help;
	for(ll i=0;i<n;i++) help[s[i]]++;
	
	vector<string> a;
	
	for(ll i=0;i<=999;i+=8){
		if(i%8==0){
			string h=to_string(i);
			ll to_add=max(0ll,3-(ll)h.size());
			
			while(to_add--) h='0'+h;
			
			map<char,ll> cn;		
			cn[h[0]]++;
			cn[h[1]]++;
			cn[h[2]]++;
			if(cn[h[0]]<=help[h[0]] && cn[h[1]]<=help[h[1]] && cn[h[2]]<=help[h[2]]){
				cout<<"Yes";
				return 0;
			}
		}
	}
	cout<<"No";
	return 0;
	
	
}
	
		