#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
using namespace std;



void three(int x, int y, int z,int* hi){
    if(x < y){
        if(x < z){
            return;
        }
        hi[0] = z;
        hi[2] = x;
        return;
    }
    else if(y < z){
        hi[0] = y;
        hi[1] = x;
        return;
    }
    hi[0] = z;
    hi[2] = x;
    return;
}

int equal(const vector<int>a,const vector<int>b,int n){
    for(int i = 0; i < n; i++){
        if(a[i] != b[i]){
            return false;
        }
    }
    return true;
}

int main(){
    vector<vector<vector<int>>> eight(9);
    int a,b,c;
    int e;
    for(int i = 13; i < 125; i++){
        e = 8*i;
        a = e/100;
        e -= a*100;
        b = e/10;
        c = e - b*10;
        if(b > 0 && c > 0){
            int hi[] = {a,b,c};
            eight[hi[0]-1].push_back({hi[1],hi[2]});
            eight[hi[1]-1].push_back({hi[0],hi[2]});
            eight[hi[2]-1].push_back({hi[1],hi[0]});
        }
    }
    string s;
    cin >> s;
    int n = s.length();
    int ans = 0;
    char a_c;
    vector<int> judge(9,1);
    vector<int> owari(9);
    if(n == 1){
        if((int)s[0] % 8 == 0){
            ans = 1;
        }
    }
    else if(n == 2){
        if((10*(int)(s[0]- '0') + (int)(s[1]-'0')) % 8 == 0 || (10*(int)(s[1]-'0') + (int)(s[0]-'0')) % 8 == 0 ){
            ans = 1;
        }
    }
    else{
        int count = 0;
        for(int x = 0; x < n-2; x++){
            a_c = s[x];
            a = (int)(a_c - '0')-1;
            if(judge[a] != 0){
                for(int i = 0; i < eight[a].size(); i++){
                    count = 0;
                    b = eight[a][i][0];
                    c = eight[a][i][1];
                    for(int y = x+1; y < n; y++){
                        int s_y = (int)(s[y] - '0');
                        if(s_y == b){
                            b = 0;
                            count++;
                        }
                        else if(s_y == c){
                            c = 0;
                            count++;
                        }
                        if(count == 2){
                            cout << "Yes" << endl;
                            return 0;
                        }
                    }
                }
            }
            judge[a] = 0;
            if(equal(judge, owari, 9)){
                break;
            }
        }
    }


    if(ans == 0){
        cout << "No" << endl;
    }
    else{
        cout << "Yes" << endl;
    }
    return 0;
}
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll = long long;
using P = pair<int,int>;

bool f(int i, map<char, int> a){
  string s = to_string(i);
  for(auto c : s){
    if(a[c] == 0) return 0;
    else a[c]--;
  }
  return 1;
}

int main() {
  string s;
  cin >> s;
  int n = s.size();
  map<char, int> a;
  for(auto c : s) a[c]++;
  string ans = "No";
  if(n == 1){
    if(s == "8") ans = "Yes";
  }
  else if(n == 2){
    for(int i = 16; i < 100; i += 8){
      if(f(i,a)) ans = "Yes";
    }
  }
  else {
    for(int i = 104; i < 1000; i += 8){
      if(f(i,a)) ans = "Yes";
    }
  }
  cout << ans << endl;
  return 0;
}
