#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using pl = pair<ll, ll>;
const ll INF = ll(1e18);
const ll mod = ll(998244353);
const double pi = acos(-1);
#define rep0(i,n) for(ll (i) = 0; (i) < (n); ++(i))
#define rrep0(i,n) for(ll (i) = (n) - 1; (i) >= 0; --(i))
#define rep1(i,n) for(ll (i) = 1; (i) <= (n); ++(i))
#define rrep1(i,n) for(ll (i) = (n); (i) >= 1; --(i))
#define nfor(i,a,b) for(ll (i) = (a); (i) < (b); ++(i))
#define rnfor(i,a,b) for(ll (i) = (b) - 1; (i) >= (a); --(i))
#define pf(x) cout << (x) << endl
#define all(x) (x).begin(),(x).end()
#define yes pf("Yes")
#define no pf("No")
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int dx[8]={1,0,-1,0,1,1,-1,-1};
const int dy[8]={0,1,0,-1,1,-1,1,-1};

int multipf(vector<string>& s){
    cout << s[0];
    rep1(i, s.size() - 1)cout << " " << s[i];
    cout << endl;
    return 0;
}

int multipf(vector<ll>& n){
    cout << n[0];
    rep1(i, n.size() - 1)cout << " " << n[i];
    cout << endl;
    return 0;
}

ll gcd(ll a,ll b){
    if(a < b)swap(a, b);
    if(b == 0) return a;
    return gcd(b,a%b);
}
 
ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b;
}

ll factorial(ll n){
    ll ans = 1;
    rep1(i, n){
        ans *= i;
        ans %= mod;
    }
    return ans;
}

ll power(ll a, ll b){
    ll ans = 1;
    while(b) {
        if(b & 1LL) ans = ans * a % mod;
        ans %= mod;
        a = a * a;
        a %= mod;
        b >>= 1;
    }
    return ans % mod;
}

//modの値の確認をすること
int main(){
    bool f = false;
    string s;
    cin >> s;
    vector<ll> c(10,0);
    rep0(i, s.size())c[s[i] - '0']++;
    int n = 8;
    while (n < 1000) {
        string t = to_string(n);
        vector<ll> m(10,0);
        rep0(i, t.size())m[t[i] - '0']++;
        bool k = true;
        rep0(i, 10)if(m[i] > c[i])k = false;
        if(k && ((s.size() < 2 && n < 10) || ( 2 <= s.size() && s.size() < 3 &&  10 < n && n < 100) || (s.size() >= 3 && n > 100)))f = true;
        n += 8;
    }
    f? yes:no;
    return 0;
}

#include<bits/stdc++.h>

using namespace std;

int a[233];
char ch[1000000+10];

bool Check(int x,int y,int z)
{
	a[x]--;
	a[y]--;
	a[z]--;
	if((a[x]>=0)&&(a[y]>=0)&&(a[z]>=0)) return true;
	a[x]++;
	a[y]++;
	a[z]++;
	return false;
}

int main()
{
	scanf("%s",ch+1);
	for(int i=1;ch[i];i++)
		a[ch[i] - '0']++;
	
	int  n = strlen(ch+1);
	if(n==1)
	{
		if(ch[1]=='8') printf("Yes");
		else printf("No");
		return 0;
	}
	if(n==2)
	{
		int x = (ch[1]-'0')*10 + ch[2] - '0';
		if(x%8==0) return printf("Yes\n"),0;
		x = (ch[2]-'0')*10 + ch[1] - '0';
		if(x%8==0) return printf("Yes\n"),0;
		printf("No");
		return 0;
	}
	
	for(int i=104;i<=999;i+=8)
	{
		if(Check(i%10,i/100,i%100/10)) return printf("Yes"),0;
	}
	printf("No");
	return 0;
}