#include <bits/stdc++.h>
using namespace std;

int main()
{
	string str;
	int a[10]={0};    
	int zh(string s);
	cin >> str;
	
	for(int i=0;i<str.size();i++)
	{
		a[str[i]-'0']++;   
	} 
	
	if(str.size()==1)   
	{
		if(zh(str) == 8)
		{
			cout << "Yes";
		}
		else
		{
			cout << "No";
		}
		return 0;
	}
	
	if(str.size()==2)  
	{
		if(zh(str)%8==0)
		{
			cout << "Yes";
		}
		else
		{
			swap(str[0],str[1]);  
			if(zh(str)%8==0)
				cout << "Yes";
			else
			    cout << "No"; 
		}	
		return 0;
	}
	
	for(int i=112;i<999;i+=8)  
	{
		int b,sh,g;
		b=i/100;    
		sh=i/10%10;
		g=i%10;   
		
		a[b]--;
		a[sh]--;
		a[g]--;
		    
		if(a[b]>=0 && a[sh]>=0 && a[g]>=0)  
		{
			cout << "Yes";
			return 0;
		}
		else
		{
			a[b]++;
			a[sh]++;
			a[g]++;
		}
	} 
	
	cout << "No";
	return 0;
}

int zh(string a)  
{
	int ans=0;
	
	for(int i=0;i<a.size();i++)
	{
		ans = ans*10+(a[i]-'0');
	}
	
	return ans; 
}

/*    BISMILLAHIR-RAHMANIR-RAHIM
 ____________________________________
|                                    |
|      SHANTO_SUST_SWE-19__029       |
|      shanto-swe029.github.io       |
|____________________________________|
*/

#include <bits/stdc++.h>
using namespace std;

#define ll          long long
#define fastio      ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pb          push_back
#define Pi          acos(-1.0)
#define r0          return 0
#define endl        "\n"
#define show(x)     cout << x << endl
#define take(x)     cin >> x
#define debug       1

int main()
{
	string s;
	std::cin >> s;
	int sz = s.size();

	if( sz == 1 ) {
		if( s == "8" ) std::cout << "Yes";
		else std::cout << "No";
		return 0;
	}

	if( sz == 2 ) {
		int d1 = s[0] - '0';
		int d2 = s[1] - '0';
		int n1 = d1 * 10 + d2;
		int n2 = d2 * 10 + d1;
		if( ( n1 % 8 == 0 ) || ( n2 % 8 == 0 ) ) {
			std::cout << "Yes";
			return 0;
		}
		else {
			std::cout << "No";
			return 0;
		}
	}

	int counter[10] = {0};

	for( int i = 0; i < sz; i++ ) {
		int x = ( int ) ( s[i] - '0' );
		counter[x]++;
	}

	std::vector < int > v;

	for( int i = 0; i < 10; i++ ) {
		if( counter[i] > 0 ) v.push_back(i);
		if( counter[i] > 1 ) v.push_back(i);
		if( counter[i] > 2 ) v.push_back(i);
	}

	bool gotcha = false;
	for( int i = 0; i < v.size(); i++ ) {
		for( int j = i + 1; j < v.size(); j++ ) {
			for( int k = j + 1; k < v.size(); k++ ) {
				int d1 = v[i];
				int d2 = v[j];
				int d3 = v[k];

				int n1 = d1 * 100 + d2 * 10 + d3;
				int n2 = d1 * 100 + d3 * 10 + d2;
				int n3 = d2 * 100 + d1 * 10 + d3;
				int n4 = d2 * 100 + d3 * 10 + d1;
				int n5 = d3 * 100 + d1 * 10 + d2;
				int n6 = d3 * 100 + d2 * 10 + d1;

				bool pass = ( n1 % 8 == 0 ) || ( n2 % 8 == 0 ) || ( n3 % 8 == 0 )
							|| ( n4 % 8 == 0 ) || ( n5 % 8 == 0 ) || ( n6 % 8 == 0 );

				if( pass ) {
					gotcha = true;
					break;
				}
			}
			if( gotcha ) break;
		}
		if( gotcha ) break;
	}

	if( gotcha ) cout << "Yes";
	else cout << "No";

	return 0;
}

//ALHAMDULILLAH
