#define _USE_MATH_DEFINES
 
#include <bits/stdc++.h>
 
using namespace std;
 
using ll = long long;
using ld = long double;
 
constexpr ll MOD = 998244353;
 
#ifndef ONLINE_JUDGE
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " (" << x.first << " : " << x.second << ")" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "["; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "]"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "(" << obj.first << ", " << obj.second << ")"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print_sim_py(void) {cout << endl;}
template <class Head> void print_sim_py(Head&& head) {cout << head;print_sim_py();}
template <class Head, class... Tail> void print_sim_py(Head&& head, Tail&&... tail) {cout << head << " ";print_sim_py(forward<Tail>(tail)...);}

#define repr(i, a, b) for (int i = a; i < b; i++)
#define rep(i, n) for (int i = 0; i < n; i++)

#define print(...) print_sim_py(__VA_ARGS__);
#else
#define print(...);
#endif

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
 
    string s;

    cin >> s;
    vector<ll> nc(10,0);
    for(int i=0; i<s.length(); i++){
        ll x=s[i]-'0';
        nc[x]++;
    }

    auto tmp = nc;
    ll ie=10,je=10;

    switch(s.length()){
    case 1:
        je = 1;
        nc[0]++;
    case 2:
        ie = 1;
        nc[0]++;
    }
    
    auto f = [&](){
        string ans = "No";
        for(ll i=0; i<ie; i++){
            for(ll j=0; j<je; j++){
                for(ll k=0; k<10; k++){
                    tmp[i]--;
                    tmp[j]--;
                    tmp[k]--;

                    if(tmp[i]>=0 && tmp[j]>=0 && tmp[k]>=0){
                        ll v = i*100+j*10+k;
                        if(v%8==0){
                            ans = "Yes";
                            return ans;
                        }
                    }
                    tmp = nc;
                }
            }
        }
        return ans;
    };

	auto ans = f();

    cout << ans << endl;


 
    return 0;
}


#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<algorithm>
#include<set>
#include<iterator>
#include <map>
#include<cmath>
#include <list>
#include<string>
#include <stdlib.h>
#include<ctime>
#include<cstring>
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define line cout<<'\n'
typedef long long ll;
using namespace std;
vector<long double>roots1;
void printVec(vector<long double>&v)
{
	int sz = v.size();
	for (long double x : v)
	{
		cout << x << " ";
	}
	line;
}
void printVec(vector<double>&v)
{
	int sz = v.size();
	for (double x : v)
	{
		cout << x << " ";
	}
	line;
}
void printVec(vector<vector<long double>>&vec)
{
	for (int i = 0; i < vec.size(); i++)
	{
		for (int j = 0; j < vec[i].size(); j++)
		{
			cout << vec[i][j] << " ";
		}
		line;
	}
	line;
}
void print(vector<pair<double, double>>&vec)
{
	int sz = vec.size();
	for (int i = 1; i < sz; i++)
	{
		cout << vec[i].first << " " << vec[i].second << endl;
	}
	line;
}
int main()
{
	fastIO
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif


	string s;
	ll n;
	cin >> s;
	int sz=s.size();
	if(sz<=2)
	{
		string s1=s;
		reverse(s1.begin(), s1.end());
		if(stoi(s)%8==0 or stoi(s1)%8==0)
		{
			cout<<"Yes\n";
		}
		else
		{
			cout<<"No\n";
		}
	}
	else
	{
		bool flag=false;
		vector<int>freq(10,0);
		for(int i=0;i<sz;i++)
		{
			freq[s[i]-'0']++;
		}
		for(int i=104;i<1000;i+=8)
		{
			int temp=i;
			flag=false;
			vector<int> freq1(10,0);
			while(temp!=0)
			{
				freq1[temp%10]++;
				temp/=10;
			}
			for(int j=0;j<10;j++)
			{
				if(freq[j]<freq1[j])
				{
					flag=true;
					break;
				}
			}
			if(!flag)
			{
				cout<<"Yes\n";
				break;
			}
		}
		if(flag)
		{
			cout<<"No\n";
		}
	}
	return 0;
}
