#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<n;i++)
using namespace std;
using ll=long long;
using P = pair<int,int>;
int main(){
    string s;
    cin >> s;
    ll c[10]={0};
    ll answer=0;
    ll one = (ll)s[0]-48;
    ll two =(ll)s[1]-48;
    ll three =(ll)s[2]-48;
    if(s.size()==1){
        if(one%8==0)answer=1;
    }else if(s.size()==2){
        if((one*10+two)%8==0)answer++;
        else if((two*10+one)%8==0)answer++;
    }
    else if(s.size()==3){
        if((one*100+two*10+three)%8==0)answer++;
        else if((one*100+three*10+two)%8==0)answer++;
        else if((two*100+one*10+three)%8==0)answer++;
        else if((two*100+three*10+one)%8==0)answer++;
        else if((three*100+one*10+two)%8==0)answer++;
        else if((three*100+two*10+one)%8==0)answer++;
    }
    else{
        for(ll i=0;i<(ll)s.size();i++){
           if(c[(ll)s[i]-48]!=3){
              c[(ll)s[i]-48]++;
          }
        }
        ll count=0;
        for(ll i=1;i<10;i++){
            count+=c[i];
        }
        ll an[count];
        ll now=0;
        for(ll i=1;i<10;i++){
            for(ll j=0;j<c[i];j++){
               an[now]=i;
              now++;
          }
        }
        for(ll a=0;a<count;a++){
         for(ll b=0;b<count;b++){
                for(ll c=0;c<count;c++){
                    if(a==b||b==c||c==a)break;
                    if((an[a]*100+an[b]*10+an[c])%8==0)answer++;
               }
         }
        }
    }
    if(answer==0)cout << "No" << endl;
    else cout << "Yes" << endl;
}
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back

// g++ -std=c++17 -Wshadow -Wall -g -fsanitize=address -fsanitize=undefined -D_GLIBCXX_DEBUG -o 

int main(){
 string s;
 cin>>s;
 map<int,int>d;
 int n=s.length();
 for(int i=0;i<n;i++){
  d[s[i]-'0']++;
 }
 if(n==1)cout<<(s=="8"?"Yes\n":"No\n");
 else if(n==2){
  string r=s;
  reverse(r.begin(),r.end());
  for(int i=16;i<100;i+=8){
   if(stoi(s)==i || stoi(r)==i){
    cout<<"Yes\n";
    return 0;
   }
  }
  cout<<"No\n";
  return 0;
 }
 if(n>=3){
  int flag=1;
  for(int i=104;i<1000;i+=8){
   map<int,int>num;
   int N=i;
   while(N){
    num[N%10]++;
    N/=10;
   }
   for(auto x:num){
    if(d[x.first]<x.second){
     flag=0;
     break;
    }
   }
   if(flag){
    cout<<"Yes\n";
    return 0;
   }
   flag=1;
  }
  cout<<"No\n";
 }
 return 0;
}
