#include <bits/stdc++.h>

int main(){
    std::string S;
    std::cin >> S;
    
    int st = 8, ed = 10;
    if(S.size() == 2){
        st = 16; ed = 100;
    }else if(S.size() >= 3){
        st = 104; ed = 1000;
    }
    std::vector< int > eight;
    for(int i=st; i<ed; i+=8){
        int tmp = i;
        bool zero = false;
        while(tmp != 0){
            int tmp2 = tmp % 10;
            if(tmp2 == 0){
                zero = true;
                break;
            }
            tmp /= 10;
        }
        if(!zero){
            eight.push_back(i);
        }
    }
    
    std::vector< int > cnt(10, 0);
    
    for(int i=0;i<S.size(); i++){
        cnt[S[i] - '0']++;
    }
    for(int i=0;i<eight.size(); i++){
        std::vector< int > cnt2(10, 0);
        int digit3 = (eight[i] % 1000) / 100;
        int digit2 = (eight[i] % 100) / 10;
        int digit1 = (eight[i] % 10) / 1;
        cnt2[digit3]++;
        cnt2[digit2]++;
        cnt2[digit1]++;
        bool ok = 1;
        for(int j=1; j<10; j++){
            if(cnt[j] < cnt2[j]){
                ok = 0;
            }
        }
        
        if(ok){
            std::cout << "Yes" << std::endl;
            return 0;
        }
    }
    
    std::cout << "No" << std::endl;
    
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<long>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using vvl = vector<vector<long>>;
using pii = pair<int, int>;
using pil = pair<int, long>;
using pll = pair<long, long>;
#define fix20 cout << fixed << setprecision(20)
#define YES cout << "Yes" << endl
#define NO cout << "No" << endl
#define rep(i,n) for(long i=0; i<(long)(n);i++)
#define REP(i,s,t) for(long i=s; i<t; i++)
#define RNG(i,s,t,u) for(long i=s; i<t; i+=u)
#define MOD 1000000007
#define all(vec) vec.begin(), vec.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main(){
  string s;
  cin >> s;
  vl cnt(10,0);
  rep(i,s.size()){
    int p = s.at(i) - '0';
    cnt.at(p)++;
  }

  if(s.size() <= 3){
    sort(all(s));
    do{
      int p = atoi(s.c_str());
      if(p % 8 == 0){
        YES;
        
        return 0;
      }
    }while(next_permutation(all(s)));
    NO;
    return 0;
  }
  
  rep(i,1000){
    vl ref(10,0);
    bool flag = true;
    if(i % 8 != 0) continue;
    int p = i / 100;
    int q = i % 100 / 10;
    int r = i % 10;
    ref.at(p)++;
    ref.at(q)++;
    ref.at(r)++;
    rep(j,10){
      if(ref.at(j) <= cnt.at(j)) continue;
      flag = false;
    }
    if(flag){
      YES;
      return 0;
    }
  }

  NO;
}