#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define MOD 1000000007

int main(void) {
  string s;
  cin >> s;
  int num[10]; rep(i,10) num[i]=0;
  int ans[111][10]; 
  for(int i=0;i<111;i++) {
    for(int j=0;j<10;j++)
    ans[i][j]=0;
  }
  int e=112,tmp;
  for(int i=0; i<112; i++) {
    if(e>=1000)break;
    tmp=e;
    ans[i][tmp/100]++;
    ans[i][(tmp-tmp/100*100)/10]++;
    ans[i][tmp%10]++;
    e+=8;
  }
  if(s.length()==1) {
    if(s[0]-'0'==8) cout << "Yes" << endl;
    else cout << "No" << endl;
  } else if(s.length()==2) {
    int ss[2]; ss[0]=(int)(s[0]-'0'); ss[1]=(int)(s[1]-'0');
    if((ss[0]*10+ss[0])%8==0) cout << "Yes" << endl;
    else if((ss[0]*10+ss[1])%8==0) cout << "Yes" << endl;
    else cout << "No" << endl;
  } else {
    for (int i = 0; i < s.length(); i++) {
      num[(int)(s[i]-'0')]++;
    }
    //for(int i=0;i<10;i++) cout << num[i] << endl;
    //104 112 120 128 136 144 152 160 ...992
    //(992-104)/8+1=112
    int key=1;
    int i,j;
    for( i =0;i<111;i++) {
      key=1;
      for( j=0; j<10; j++) {
        if(ans[i][j]>num[j]) {key=-1;}
      }
      if(key==1) {cout << "Yes" << endl; 
      //cout << "i==" << i << endl;
      break;}
    }
    if(key!=1){cout << "No" << endl;}
  }
}
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, j, k) for(int i = j; i < k; i++)
#define print(x) cout << x
#define newline cout << endl
#define space cout << ' '
#define INF 1000000007
using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;

int main(){
    string s;
    cin >> s;
    vl v(10,0);
    rep(i,s.size()){
        ll tmp=s[i]-'0';
        v[tmp]++;
    }
    ll ev=v[2]+v[4]+v[6]+v[8];
    ll od=v[1]+v[3]+v[5]+v[7]+v[9];
    if(s.size()==1){
        if(v[8]){
            print("Yes");
            return 0;
        }
    }
    else if(s.size()==2){
        if(v[2]>0&&(v[3]+v[4]+v[7]>0)){
            print("Yes");
            return 0;
        }
        if(v[4]>0&&(v[2]+v[6]+v[8]>0)){
            print("Yes");
            return 0;
        }
        if(v[6]>0&&(v[1]+v[4]+v[5]+v[9]>0)){
            print("Yes");
            return 0;
        }
        if(v[8]==2){
            print("Yes");
            return 0;
        }
    }
    else{
        if(v[2]>0&&(v[3]+v[7]>0)&&(ev>1)){
            print("Yes");
            return 0;
        }
        if(v[2]>0&&(v[4]>0)&&(ev>2)){
            print("Yes");
            return 0;
        }
        if(v[4]>0&&(v[2]+v[6]+v[8]>0)&&(ev>2)){
            print("Yes");
            return 0;
        }
        if(v[6]>0&&(v[1]+v[5]+v[9]>0)&&(ev>1)){
            print("Yes");
            return 0;
        }
        if(v[8]>1&&(ev>2)){
            print("Yes");
            return 0;
        }
        if(v[2]>0&&(v[1]+v[5]+v[9]>0)&&(od>1)){
            print("Yes");
            return 0;
        }
        if(v[2]>0&&v[8]>0&&ev>0){
            print("Yes");
            return 0;
        }
        if(v[4]>1&&od>0){
            print("Yes");
            return 0;
        }
        if(v[8]>0&&(v[4]+v[6]>0)&&od>0){
            print("Yes");
            return 0;
        }
        if(v[6]>0&&v[3]+v[7]>0&&od>1){
            print("Yes");
            return 0;
        }
    }
    print("No");
    return 0;
}