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

int main() {
  string s;cin>>s;
  int i;
  int an[10];rep(i,10)an[i]=0;
  for (auto c: s) {
    i = c - '0';
    if (an[i]<3) an[i]++;
  }
  vi bn;
  rep(i, 10) {
    rep(j, an[i]) bn.push_back(i);
  }
  
  int n = bn.size();
  if (n == 1) {
      if (bn[0] % 8 == 0) {
        cout<<"Yes"<<endl;
        return 0;
      }
  } else if (n == 2) {
      if ((bn[0]*10 + bn[1]) % 8 == 0 or (bn[1]*10 + bn[0]) % 8 == 0) {
        cout<<"Yes"<<endl;
        return 0;
      }
  } else {
    rep(i,n) rep(j,n) rep(k,n) {
      if (i==j or j==k or k==i) continue;
      if ((bn[i]*100 + bn[j]*10 + bn[k]) % 8 == 0) {
        cout<<"Yes"<<endl;
        return 0;
      }
    }
  } 
  
  cout<<"No"<<endl;
  return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main(){
  string k;
  cin >> k;
  if(k.length() == 1){
    if(k[0] == '8'){
      cout << "Yes";
      return 0;
    }
    cout << "No";
    return 0;
  }
  if(k.length() == 2){
    if((k[0] * 10 + k[1]) % 8 == 0 || (k[1] * 10 + k[0]) % 8 == 0){
      cout << "Yes";
      return 0;
    }
    cout << "No";
    return 0;
  }
  int bucket[10] = {0};
  for(int i = 0;i < k.length();i++){
    bucket[k[i] - '0']++;
  }
  for(int i = 112;i <= 1000;i += 8){
    if(i % 10 == 0 || i / 10 % 10 == 0){
      continue;
    }
    int ge = i % 10;
    int shi = i / 10 % 10;
    int bai = i / 100;
    int b1[10] = {0};
    b1[ge]++;
    b1[shi]++;
    b1[bai]++;
    bool ok = true;
    for(int i = 1;i <= 9;i++){
      if(b1[i] > bucket[i]){
        ok = false;
        break;
      }
    }
    if(ok){
      cout << "Yes";
      return 0;
    }
  }
  cout << "No";
  return 0;
}