#include <bits/stdc++.h>
#include <math.h>
#define ALL(a)    a.begin(), a.end() 
#define rep(i, K, N)  for(long long int i = K; i < N; i++)
#define ll long long int
#define PP 1000000007
using namespace std;

int main(){
string S;cin >> S;
ll N = S.size();
bool C;
map<char, ll> M;
vector<ll> V(124, -1);
if(1 == N)V[0] = 8;
  
if(2 == N)V[0] = 16;
  
if(3 <= N)V[0] = 104;

rep(i, 0, 123){
  
  if(8 + V[i] > 1000)break;

  V[i + 1] = 8 + V[i];
  
}

for(auto x : S )M[x]++;

for(auto x : V ){

  string T = to_string(x);
  map<char, ll> m;
  C = 1;//cout << T << endl;

  for(auto y : T )m[y]++;

  for(auto z : m ){
  
    if(z.second > M[z.first]){C = 0;break;}

  }

  if(C == 1)break;

  m.clear();

}

if(C == 1)cout << "Yes";

else cout << "No";

}
#include <bits/stdc++.h>
// #include <atcoder/all>
// using namespace atcoder;

using namespace std;
using ll = long long;

int main() {
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);

    string S;
    cin >> S;

    map<char, int> digits;
    for (int i = 0; i < S.length(); i++) {
        digits[S[i]]++;
    }

    // for (auto d : digits) {
    // cout << d.first << " " << d.second << endl;
    // }

    if (S.length() >= 3) {
        for (int i = 1; i < 10; i++) {
            for (int j = 1; j < 10; j++) {
                for (int k = 1; k < 10; k++) {
                    map<char, int> tmp = digits;
                    if ((i * 100 + j * 10 + k) % 8 == 0) {
                        if (tmp['0' + i] != 0)
                            tmp['0' + i]--;
                        else
                            continue;
                        if (tmp['0' + j] != 0)
                            tmp['0' + j]--;
                        else
                            continue;
                        if (tmp['0' + k] != 0)
                            tmp['0' + k]--;
                        else
                            continue;
                        cout << "Yes" << endl;
                        return 0;
                    }
                }
            }
        }
    } else if (S.length() == 1) {
        if (S[0] == '8') {
            cout << "Yes" << endl;
            return 0;
        } else {
            cout << "No" << endl;
            return 0;
        }
    } else {
        if (((S[0] - '0') * 10 + (S[1] - '0')) % 8 == 0) {
            cout << "Yes" << endl;
            return 0;
        }
        if (((S[1] - '0') * 10 + (S[0] - '0')) % 8 == 0) {
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;

    return 0;
}
