#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <utility>
#include <deque>
#include <stack>
#include <bitset>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
#define rep(i,n) for (int i=0;i<n;++i)
#define REP(i,n) for (int i=1;i<=n;++i)
#define all(x) x.begin(),x.end()
#define mp make_pair
#define pb push_back
#define pf push_front
#define F first
#define S second
#define RI(x) scanf("%d",&x)
#define RII(x,y) scanf("%d%d",&x,&y)
int cnt[10];
char s[200005];

int main(){
	ios::sync_with_stdio(false);
	cin>>s+1;
	int len=strlen(s+1);
	for (int i=1;i<=len;++i) cnt[s[i]-'0']++;
	if (len>=3){
		for (int x=0;x<1000;++x){
			if (x%8) continue;
			int a=x%10,b=(x/10)%10,c=x/100;
			--cnt[a];--cnt[b];--cnt[c];
			if (cnt[a]>=0&&cnt[b]>=0&&cnt[c]>=0){
				cout<<"Yes"<<endl;return 0;
			}
			++cnt[a];++cnt[b];++cnt[c];
		}
		cout<<"No";
	}
	else{
		if (len==1){
			if ((s[1]-'0')%8==0) cout<<"Yes";
			else cout<<"No";
		}
		else{
			if (((s[1]-'0')*10+s[2]-'0')%8==0) cout<<"Yes";
			else if (((s[2]-'0')*10+s[1]-'0')%8==0) cout<<"Yes";
			else cout<<"No";
		}
	}
	
	return 0; 
}
#include"iostream"
#include"cstdio"
#include"cmath"
#include"cstring"
#include"algorithm"
#include"stack"
#include"queue"
using namespace std;

#define read(x) scanf("%d",&x)
#define readl(x) scanf("%lld",&x)
#define ll long long 
#define ull unsigned long long
#define MOD 998244353
#define MAXN 200005 

char c[200005];
int cnt[15]={0};
int len=0;

int main()
{
	scanf("%s",c);
	int len=strlen(c);
	for(int i=0;i<len;i++) cnt[c[i]-'0']++;
	if(len==1&&c[0]=='8') return puts("Yes"),0;
	for(int i=2;i<=12;i++)
	{
		if(i==11)
		{
			if(cnt[8]>=2)
			{
				cnt[8]-=2;
				if(len==2) return puts("Yes"),0;
				for(int j=2;j<=8;j+=2)
				{
					if(cnt[j])
					{
						puts("Yes");
						return 0;
					}
				}
				cnt[8]+=2;
			}
			continue;
		}
		if(i==5||i==10) continue;
		int op=i*8;
		int q=op/10,w=op%10;
		if(cnt[q]&&cnt[w])
		{
			if(len==2) return puts("Yes"),0;
			cnt[q]--,cnt[w]--;
			for(int j=2;j<=8;j+=2)
			{
				if(cnt[j])
				{
					puts("Yes");
					return 0;
				}
			}
			cnt[q]++,cnt[w]++;
		}
	}
	if(len<3) return puts("No"),0;
	for(int i=13;i<125;i++)
	{
		int op=i*8;
		int a=op/100,b=(op/10)%10,s=op%10;
		if(!a||!b||!c) continue;
		if(a==b&&b==s) 
		{
			if(cnt[a]>=3) return puts("Yes"),0;
		}
		else if(a==b)
		{
			if(cnt[a]>=2&&cnt[s]) return puts("Yes"),0;
		}
		else if(b==s)
		{
			if(cnt[b]>=2&&cnt[a]) return puts("Yes"),0;
		}
		else if(a==s)
		{
			if(cnt[a]>=2&&cnt[b]) return puts("Yes"),0;
		}
		else if(cnt[a]&&cnt[b]&&cnt[s]) return puts("Yes"),0;
	}
	return puts("No"),0;
} 