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

int main(){
  string S; cin >> S;
  int len = S.size();
    
  if(len == 1){
    int n = S.at(0) - '0';
    if(n % 8 == 0){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
    return 0;
  }
  if(len == 2){
    int a = S.at(0) - '0';
    int b = S.at(1) - '0';
    if((a * 10 + b) % 8 == 0 || (b * 10  + a) % 8 == 0){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
    return 0;
  }
  map<int,int> sum_i;
  for(int i = 1; i < 10; i++){
    sum_i[i] = 0;
  }
  for(int i = 0; i < len; i++){
    int num = S.at(i) - '0';
    sum_i[num]++;
  }
  
  bool flag = false;
  for(int i = 100; i < 1000; i++){
    if(i % 8 != 0) continue;
    string str = to_string(i);
    if(str.at(0) == '0' || str.at(1) == '0' || str.at(2) == '0'){
      continue;
    }
    map<int,int> m;
    for(int i = 1; i < 10; i++){
    m[i] = 0;
    }
    int c = i;
    while(c > 0){
      m[c%10]++;
      c /= 10;
    }
    int p = 0;
    for(int i = 1; i <= 9; i++){
      if(sum_i[i] >= m[i]){
        p++;
      }
    }
    if(p == 9) flag = true;
  }
  if(flag){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}
  
  
#include<bits/stdc++.h>
#define pb push_back
#define mk make_pair
#define ll long long
#define ss second
#define ff first
#define mod 1000000007
#define w(x) ll x; cin>>x; while(x--)
#define ps(x,y) fixed<<setprecision(y)<<x;
#define fo(i, j, k, in) for (ll i=j ; i<k ; i+=in)
#define re(i, j) fo(i, 0, j, 1)
#define pi acos(-1)
#define all(cont) cont.begin(), cont.end()
#define countbit(x) __builtin_popcount(x)
#define mod 1000000007
#define de(n) ll n;cin>>n;
#define def(a,n) ll n;cin>>n;ll a[n];re(i,n){cin>>a[i];}
#define defi(a,n,k) ll n;cin>>n; ll k;cin>>k;ll a[n];re(i,n){cin>>a[i];}
#define deb(x) cout<<#x<<"="<<x<<endl;
#define tr(it,a) for(auto it=a.begin();it!=a.end();it++)
#define nl cout<<endl;
using namespace std;
void cp()
{
    ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0); 
    #ifndef ONLINE_JUDGE  
    freopen("input.txt", "r", stdin);  
    freopen("output.txt", "w", stdout);
#endif
}
//18-1326D1 1208B 845C 912B 1009B 1350C 20C 1333C 1234D 1327C 1305B 1304B (or in matrix)
bool solve(string s)
{
   ll n=s.length();
   if(n==1)
   {
      if(s[0]=='8')
      return true;
   }
   if(n==2)
      {
         if(stoi(s)%8==0)
         return true;
         else
         {
            swap(s[0],s[1]);
            if(stoi(s)%8==0)
            return true;  
         }
      }
      map<ll,ll>p;
      re(i,n)
      p[s[i]-'0']++;
      for(ll i=112;i<=1000;i+=8)
      {
         auto h=p;
         ll j=i;
         bool got=0;
         while(j!=0)
         {
            h[j%10]--;
            if(h[j%10]<0)
            {
               got=1;
               break;
            }
            j=j/10;
         }
         if(got==0)
         return true;
      }
      return false;
}
int main()
{
   //cp();
   //w(x)
   {
      string s;
      cin>>s;
      //ll n=s.length();
      if(solve(s))
      cout<<"Yes\n";
      else
      {
         cout<<"No\n";
      }
   }
}