#include <bits/stdc++.h>
using namespace std;

int main(){
    string s;
    cin >> s;
    vector<int> num(10, 0);
    int size1 = s.size();
    for(int i = 0; i < s.size(); i++){
        num[s[i] - '0']++;
    }

    int hati = 0;
    bool flag;
    while(hati < 1000){
        vector<int> num8(10, 0);
        string moji = to_string(hati);
        for(int i = 0; i < moji.size(); i++){
            num8[moji[i] - '0']++;
        }
        int size2 = moji.size();
        if(size1 > size2) num8[0] += (size1 < 3 ? size1 : 3) - size2;

        flag = true;
        for(int i = 0; i < 10; i++){
            if(num[i] < num8[i]) flag = false;
            //printf("%s : %d < %d\n", moji, num[i], num8[i]);
        }
        if(flag == true) break;

        hati += 8;
    }

    cout << (flag ? "Yes" : "No") << endl;
    return 0;
}
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,s,n) for(int i = s; i < n; i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
using Graph = vector<vector<int>>;
const int INF = 1000000007;
int main(){
  string s;
  cin >> s;
  vector<ll>v(s.size());
  int n = s.size();
  rep(i,n)v[i] = s[i] - '0';
  vector<ll>ans;
  REP(i,0,999)if((i + 1) % 8 == 0 && ((i + 1) % 10 != 0))ans.push_back(i + 1);
  int sz = ans.size();
  ll cnt = 0;
  ll a,b,c;
  vector<ll>cntt(10);
  cntt[0] = 300000000;
  rep(i,n)cntt[v[i]]++;
  rep(i,sz){
    a = ans[i] % 10;
    ans[i] /= 10;
    b = ans[i] % 10;
    ans[i] /= 10;
    c = ans[i];
    if(c != 0 && b == 0)continue;
    ll check = 0;
    if(a == 0)check++;
    if(b == 0)check++;
    if(c == 0)check++;
    if(check == 1){
      if(n != 2)continue;
    }
    if(check == 2){
      if(n != 1)continue;
    }
    cntt[a]--;
    cntt[b]--;
    cntt[c]--;
    if((cntt[a] >= 0) && (cntt[b] >= 0) && (cntt[c] >= 0)){
      cout << "Yes" << endl;
      return 0;
    }
    cntt[a]++;
    cntt[b]++;
    cntt[c]++;
  }
  cout << "No" << endl;
  return 0;
}
