#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <vector>
#include <map>
#include<cstdio>
#include<functional>
#include <bitset>
#include <iomanip>
#include <cctype>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define ll long long
using namespace std;
template <typename T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
template <typename T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
const ll INF = 1000000000000000000;
const ll MOD = 1e9 + 7;
using vv = vector<vector<ll>>;
using vec = vector<ll>;
using P = pair<ll, ll>;

int main()
{
	string s; cin >> s;
	map<char, ll> mp;
	rep(i, s.size()) {
		mp[s[i]] += 1;
	}
	ll now = 0;

	string ansl = "No";
	rep(i, 200) {
		bool ok = true;
		map<char, ll> copy = mp;
		now += 8;
		if (now >= 1000)
		{
			break;
		}
		string st = to_string(now);
		if (s.size() >= 3 && st.size() <= 2) {
			continue;
		}
		if (s.size() >= 2 && st.size() <= 1) {
			continue;
		}
		rep(j, st.size()) {
			if (copy[st[j]] >= 1) {
				copy[st[j]]--;
			}
			else {
				ok = false;
				break;
			}
		}
		if (ok)
		{
			ansl = "Yes";
			break;
		}
	}
	cout << ansl << endl;
	system("Pause");
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

int main(){
    string s;
    cin >> s;
    vvi eight(125, vi(10));
    eight[0][0] = 3;
    for(int i = 1; i<=124; i++){
        int hyaku = i*8/100;
        int ten = (i*8-hyaku*100)/10;
        int one = i*8-hyaku*100-ten*10;
        eight[i][hyaku] ++;
        eight[i][ten] ++;
        eight[i][one] ++;
    }
    vi sv(10);
    if(s.size() == 1) sv[0] += 2;
    else if (s.size() == 2) sv[0] ++;
    rep(i,s.size()) {
        int mozi = s[i] - '0';
        sv[mozi] ++;
    }
    if(s.size() <= 2){
        if(s.size() == 1){
            if(stoi(s)%8 == 0) cout << "Yes" << endl;
            else cout << "No" << endl;
        }
        else{
            if(stoi(s)%8 == 0) cout << "Yes" << endl;
            else{
                reverse(s.begin(),s.end());
                if(stoi(s)%8 == 0) cout << "Yes" << endl;
                else cout << "No" << endl;
            }
        }
        return 0;
    }
    bool ok = false;
    rep(i,125){
        bool tasika = true;
        rep(j,10){
            if(eight[i][j] <= sv[j]) continue;
            else tasika = false;
        }
        if (tasika) ok = true;
    }
    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
}
