#include <bits/stdc++.h>
#define lg long long int
#define loop(i, s, e) for (lg i = s; i <= e; i++)
#define iloop(i, s, e) for (lg i = e; i >= s; i--)
#define pb push_back
#define mp make_pair
#define mod 1000000007
using namespace std;

lg min(lg a, lg b)
{
	return a < b ? a : b;
}
lg max(lg a, lg b)
{
	return a > b ? a : b;
}
lg lcm(lg a, lg b)
{
	return (a * b) / __gcd(a, b);
}
lg ans = 0;
lg n, m;
bool sortfn(vector<lg> &a, vector<lg> &b)
{
	return a[0] > b[0];
}

lg sol(vector<string> &grid, vector<vector<lg>> &dp, lg i, lg j)
{
	if (i == n - 1 && j == m - 1)
		return 1;
	else if (dp[i][j] != -1)
		return dp[i][j];
	else
	{
		lg total = 0;
		for (lg in = i + 1; i < n; i++)
		{
			if (grid[in][j] == '#')
				break;
			total += sol(grid, dp, in, j);
			total %= mod;
		}
		for (lg jn = j + 1; j < m; j++)
		{
			if (grid[i][jn] == '#')
				break;
			total += sol(grid, dp, i, jn);
			total %= mod;
		}
		for (lg k = 1; k < min(n - i, m - j); k++)
		{
			if (grid[i + k][j + k] == '#')
				break;
			total += sol(grid, dp, i + k, j + k);
			total %= mod;
		}
		dp[i][j] = total % mod;
		return dp[i][j];
	}
}
vector<lg> nums(11, 0);
bool possible(lg n)
{
	string s = to_string(n);
	vector<lg> local(11, 0);
	for (lg i = 0; i < s.length(); i++)
	{
		if(s[i] - 48 == 0) return false;
		local[s[i] - 48]++;
	}
	local[0]+=max(3-s.length(),0);
	for (lg i = 0; i < 10; i++)
	{
		if (local[i] > nums[i])
			return false;
	}
	return true;
}

int main()
{
	string s;
	cin >> s;
	lg l = s.length();
	for (lg i = 0; i < l; i++)
	{
		nums[s[i] - 48]++;
	}
	nums[0]+=max(3-s.length(),0);
	bool poss = false;
	for (lg i = 0; i < 1000; i += 8)
	{
		if (possible(i))
		{
			poss = true;
			break;
		}
	}
	if (poss)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
#include <bits/stdc++.h>
using namespace std;

string s;
int f[10];

int main() {
	ios::sync_with_stdio(0);

	cin >> s;

	memset(f, 0, sizeof(f));
	for(int i = 0; i < s.size(); i++)
		f[s[i] - '0']++;

	if(s.size() == 2) {
		int d1 = (s[0] - '0') * 10 + (s[1] - '0');
		int d2 = (s[1] - '0') * 10 + (s[0] - '0');
		if(d1 % 8 == 0 || d2 % 8 == 0)
			cout << "Yes" << endl;
		else cout << "No" << endl;
		return 0;
	}
	if(s.size() == 1) {
		if(s == "8")
			cout << "Yes" << endl;
		else cout << "No" << endl;
		return 0;
	}

	for(int i = 112; i < 1000; i += 8) {
		int d1 = i / 100;
		int d2 = i / 10 % 10;
		int d3 = i % 10;

		int t[10];
		for(int i = 0; i <= 9; i++)
			t[i] = f[i];
		if(t[d1] > 0) t[d1]--;
		else continue;
		if(t[d2] > 0) t[d2]--;
		else continue;
		if(t[d3] <= 0) continue;

		cout << "Yes" << endl;
		return 0;
	}
	cout << "No" << endl;
	return 0;
}