#include "bits/stdc++.h"
#define ll long long int
#define ld long double
#define fastIO ios_base::sync_with_stdio(false); cin.tie(nullptr)
#define pb push_back

using namespace std;
typedef pair<int, int> pii;

int main() {
    fastIO;
    string s;
    cin >> s;

    map<int, int> digits;
    for (int i = 0; i < s.length(); i++) {
        int d = s[i] - '0';
        digits[d]++;
    }

    bool possible = false;
    int i;
    if (s.length() == 1) i = 8;
    else if (s.length() == 2) i = 16;
    else i = 104;
    for (; i < 1000; i += 8) {
            map<int, int> temp;
            int num = i;
            while (num > 0) {
                temp[num % 10]++;
                num /= 10;
            }
            bool poss = true;
            for (pii p : temp) {
                if (digits[p.first] < p.second) poss = false;
            }
            possible |= poss;
    }

    if (possible) cout << "Yes";
    else cout << "No";
}

#include <bits/stdc++.h>
 
#define rep(i,n) for(ll i=0;i<n;++i)
#define rrep(i, n) for(ll i=n-1;i>=0;--i)
#define rep1(i, n) for(ll i=1; i<=n; ++i)
#define repitr(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}}
template<class T> void chmin(T &a, const T &b){if(a > b){a = b;}}

using namespace std;
using ll  = long long;
using ull = unsigned long long;
using pll = pair<ll, ll>;

const ll MOD  = 1e9 + 7;
const ll LINF = 1LL << 60;
const int INF = 1e9 + 7;
const double PI = 3.1415926535897932384626433;

ll Str2Long(string s){
    reverse(ALL(s));
    ll n = 0;
    rep(i, s.size()){
        n += (s[i]-'0')*pow(10, i);
    }
    return n;
}
string Long2Str(ll x){
    if(x <= 0)return "";
    char c = '0' + x % 10;
    return Long2Str(x/10) + c;
}

int main(){
    string s;
    cin >> s;

    if(s.size() == 1){
        if(s == "8" || s=="0")cout << "Yes";
        else cout << "No";
        return 0;
    }
    if(s.size() == 2){
        if(Str2Long(s) % 8 == 0)cout << "Yes";
        else {
            reverse(ALL(s));
            if(Str2Long(s) % 8 == 0)cout << "Yes";
            else cout << "No";
        }
        return 0;
    }

    vector<ll> cnt(10, 0);
    for(char c: s){
        cnt[c - '0']++;
    }

    for(ll i = 104; i <= 992; i += 8){
        string s_i = Long2Str(i);
        ll cnt_0 = cnt[s_i[0] - '0'];
        ll cnt_1 = cnt[s_i[1] - '0'];
        ll cnt_2 = cnt[s_i[2] - '0'];

        if(cnt_0 * cnt_1 * cnt_2 == 0)continue;

        bool ok = false;

        if(s_i[0] == s_i[1] && s_i[0] == s_i[2]){
            if(cnt_0 >= 3)ok = true;
        }
        else if(s_i[0] == s_i[1]){
            if(cnt_0 >= 2 && cnt_2 >= 1)ok = true;
        }
        else if(s_i[1] == s_i[2]){
            if(cnt_0 >= 1 && cnt_1 >= 2)ok = true;
        }
        else if(cnt_0 >= 1 && cnt_1 >= 1 && cnt_2 >= 1)ok = true;

        if(ok){
            cout << "Yes";
            return 0;
        }
    }

    cout << "No";
}