#include <bits/stdc++.h>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
using namespace std;

vector<string> v{
  "8",
  "16",
  "61",
  "24",
  "42",
  "32",
  "23",
  "48",
  "84",
  "56",
  "65",
  "64",
  "46",
  "72",
  "27",
  "88",
  "96",
  "69"
};

bool Solve(string s)
{
  if (find(v.begin(), v.end(), s) != v.end())
    return true;

  sort(s.begin(), s.end());
  rep(i,13,124)
  {
    string t = to_string(i * 8);
    sort(t.begin(), t.end());
    if (s.find(t) != string::npos)
      return true;
  }

  return false;
}

int main() {
  string s;
  cin >> s;
  if (Solve(s)) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define INF 0x7fffffff
typedef long long ll;
typedef long double ld;

typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<ld> vld;

#define fastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

#define sz(x) (int)x.size()
#define beg(x) x.begin()
#define en(x) x.end()

int main()
{
	fastIO;
	set<vi> S, S2, S3;
	for(int i = 16; i < 100; i += 8) 
	{
		int a, b;
		vi v(10,0);
		a = i % 10; v[a]++;
		b = i / 10; v[b]++;
		S2.insert(v);
	}
	for(int i = 0; i < 1000; i += 8)
	{
		int a, b, c;
		vi v(10,0);
		a = i % 10; v[a]++;
		b = i / 10 % 10; v[b]++;
		c = i / 100; v[c]++;
		// for(int j = 0; j < 10; j++) printf("v[%d] = %d\n", j, v[j]);
		// cout << endl;
		S.insert(v);
	}
	// for(auto x : S)
	// {
	// 	for(int i = 0; i < 10; i++)
	// 		cout << x[i] << ' ';
	// 	cout << endl;
	// }

	string s; cin >> s;
	int cnt[10] = {0};
	for(int i = 0; i < s.length(); i++) cnt[s[i] - '0']++;
	if(s.length() == 1) printf("%s\n", cnt[8] == 1 ? "Yes" : "No");
	else if(s.length() == 2)
	{
		if(cnt[1] & cnt[6] | cnt[2] & cnt[4] | cnt[3] & cnt[2] | cnt[4] & cnt[0] | cnt[4] & cnt[8] | cnt[5] & cnt[6] | cnt[6] & cnt[4] | cnt[7] & cnt[2] | cnt[8] & cnt[0] | cnt[8] == 2 | cnt[9] & cnt[6])
			cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	else 
	{
		for(auto x : S)
		{
			int k = 1;
			for(int i = 0; i < 10; i++)
				if(cnt[i] < x[i])
					k = 0;
			if(k) 
			{
				cout << "Yes" << endl;
				return 0;
			}
		}
		cout << "No" << endl;		
	}

	return 0;
}