#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define f first
#define s second
#define pb push_back
#define eb emplace_back
#define mk make_pair
#define mt make_tuple
#define MOD 1000000007
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
#define all(x) x.begin(), x.end()
#define vi vector<int>
#define vl vector <long long int>
#define pii pair <int,int>
#define pll pair <long long int, long long int>
#define vpii vector< pair<int,int> >
#define vpll vector < pair <long long int,long long int> >
#define boost ios::sync_with_stdio(false); cin.tie(0)
using namespace std;
const int inf = 1e9 + 5;
const ll inf64 = 1e18 + 5;

int main()
{
	boost;
	ll n, i;
	cin >> n;
	
	auto get = [] (ll a, ll b) {
		return (a * b) / (__gcd(a, b));	
	};
	
	ll ans = 1;
	foe(i, 2, n)
	ans = get(ans, i);
	cout << ans + 1;
}

/*
Credit_Card_CRD
*/
#include <iostream>
#include <string>
#include <cmath>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <iomanip>
#include <cstdlib>
#include <ctime>
#include <set>
#include <map>
#include <utility>
#include <queue>
#include <vector>
#include <stack>
#include <sstream>
#include <algorithm>
#include <fstream>
#include <functional>
#include <string.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define forn(i,a,b) for(int i=a;i<b;i++)
#define m_p make_pair
#define pb push_back
#define foreach(i,c) for(__typeof(c.begin())i=(c.begin());i!=(c).end();i++)
#define sz(s) s.size()
#define all(s) s.begin(),s.end()
#define MOD 1000000007
#define imax 2147483647
#define llmax 9223372036854775807
typedef long long ll;

using namespace std;

long long read()
{
	char c=getchar();
	long long x=0LL;
	while(c<'0'||c>'9')
	c=getchar();
	while(c>='0'&&c<='9')
	{
		x*=10LL;
		x+=(c-'0');
		c=getchar();
	}
	return x;
}

string i_to_s(int x)
{
	string t="";
	while(x)
	{
		t+=x%10+'0';
		x/=10;
	}
	reverse(all(t));
	return t;
}

int s_to_i(string t)
{
	int x=0;
	rep(i,sz(t))
	{
		x=x*10+(t[i]-'0');
	}
	return x;
}

string s;
int a[20]; 

int main()
{
	cin>>s;
	if(sz(s)<4){
		sort(all(s));
		do{
			int now=s_to_i(s);
			if(now%8==0){
				cout<<"Yes"<<endl;
				return 0;
			}
		}
		while(next_permutation(s.begin(),s.end()));
		cout<<"No"<<endl;
		return 0;
	}
	rep(i,sz(s))
	a[(int)(s[i]-'0')]++;
	int now=0;
	while(now<1000){
		now+=8;
		if(now>=1000)
		break;
		int a1=now/100,a2=now/10%10,a3=now%10;
		a[a1]--;
		if(a[a1]<0){
			a[a1]++;
			continue;
		}
		a[a2]--;
		if(a[a2]<0){
			a[a1]++;
			a[a2]++;
			continue;
		}
		a[a3]--;
		if(a[a3]<0){
			a[a1]++;
			a[a2]++;
			a[a3]++;
			continue;
		}
		cout<<"Yes"<<endl;
		return 0;
	} 
	cout<<"No"<<endl;
	return 0;
}