#include<bits/stdc++.h>
 
using namespace std;
 
#define FOR(i, x, y) for(int i = (x); i < (y); ++i)
#define REP(i, x, y) for(int i = (x); i <= (y); ++i)
#define PB push_back
#define MP make_pair
#define PH push
#define fst first
#define snd second
typedef long long ll;
typedef unsigned long long ull;
typedef double lf;
typedef long double Lf;
typedef pair<int, int> pii;
 
const int maxn = 2e5 + 5;
 
int n;
int cnt[10], tmp[10];
char s[maxn];
 
int main(){
	scanf("%s", s);
	n = strlen(s);
	reverse(s, s + n);
	
	if(n <= 3){
        sort(s, s + n);
		do{
			int val = 0; 
			FOR(i, 0, n)
				(val *= 10) += (s[i] - '0');
			if(!(val % 8)){
				puts("Yes");
				return 0;
			}
		}
		while(next_permutation(s, s + n));
		puts("No");
		return 0;
	}
	
	FOR(i, 0, n)
		++cnt[s[i] - '0'];
		
	FOR(i, 0, 10) FOR(j, 0, 10) FOR(k, 0, 10){
		FOR(x, 0, 10)
			tmp[x] = 0;
		++tmp[i]; ++tmp[j]; ++tmp[k];
		bool f = true;
		FOR(x, 0, 10)
			f &= (tmp[x] <= cnt[x]);
		if(f && !((i + j * 10 + k * 100) % 8)){
			puts("Yes");
			return 0;
		}
	}
	
	puts("No");
	return 0;
}
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

string s;
int cnt[10];

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> s;
	for(char i : s) cnt[i - '0']++;
	int i = 8;
	if((int)s.length() == 2) i = 16;
	else if((int)s.length() > 2) i = 104;
	for(; i < 1000; i += 8){
		string num = to_string(i);
		int work = true;
		for(char i : num){
			cnt[i - '0']--;
			if(cnt[i - '0'] < 0) work = false;
		}
		if(work){
			cout << "Yes\n";
			return 0;
		}
		for(char i : num) cnt[i - '0']++;
	}
	cout << "No\n";
	return 0;
}