#include <iostream>
#include <vector>
#include <string>

void solve() {
    std::string s;
    std::cin >> s;
    int n = s.length();

    std::vector<int> cnt(10, 0);
    for (auto c : s) ++cnt[c - '0'];

    for (int i = 0; i < 10; ++i) {
        if (cnt[i] == 0 && (i != 0 || n != 0)) continue;
        --cnt[i];
        --n;

        for (int j = 0; j < 10; ++j) {
            if (cnt[j] == 0 && (j != 0 || n != 0)) continue;
            --cnt[j];
            --n;

            for (int k = 0; k < 10; ++k) {
                if (cnt[k] == 0 && (k != 0 || n != 0)) continue;
                --cnt[k];
                --n;

                int x = k * 100 + j * 10 + i;
                if (x % 8 == 0) {
                    std::cout << "Yes\n";
                    return;
                }

                ++cnt[k];
                ++n;
            }
            ++cnt[j];
            ++n;
        }
        ++cnt[i];
        ++n;
    }

    std::cout << "No\n";
}

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

    solve();

    return 0;
}

#include <iostream>
#include <functional>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <queue>
#include <map>
#include <iomanip>
#include <complex>
#include <random>
#include <bitset>
#include <list>
#include <assert.h>
// #include <prettyprint.hpp>
using namespace std;
#define repi(i,n) for(int i=0;i<n;++i)
#define rep(i,n) for(ll i=0;i<n;++i)
#define repinvi(i,n) for(int i=n-1;i>=0;--i)
#define sll(n) scanf("%lld", &n);
#define sii(n) scanf("%d", &n);
#define slf(n) scanf("%lf", &n);
#define pll pair<ll,ll>
#define pii pair<int,int>
#define psi pair<si,si>
#define v(t) vector<t>
#define vv(t) vector<vector<t>>
#define vvv(t) vector<vector<vector<t>>>
typedef long long ll;
typedef double lf;
typedef short int si;


void Main(){
    string S;
    cin >> S;
    map<char, ll> counter;
    rep(i, S.size()){
        counter[S[i]] ++;
    }
    // rep(i, 10){
    //     if(counter.find(i+1) == counter.end()){
    //         counter['1'+i] = 0;
    //     }
    // }
    v(string) string_list;
    string base;
    if(S.size() == 1){
        base = "0";
    }else if(S.size() == 2){
        base = "00";
    }else{
        base = "000";
    }
    rep(i, 1001){
        if(i==1000)break;
        if(i % 8==0){
            string new_b = base;
            new_b[0] += i % 10;
            if(S.size() >= 2){
                new_b[1] += (i % 100) / 10;
            }
            if(S.size()>=3){
                new_b[2] += i / 100;
            }
            string new_b2 = "";
            rep(i, new_b.size()){
                new_b2 += new_b[new_b.size()-i-1];
            }
            string_list.push_back(new_b2);
        }
        // if(S.size()<=3){
        //     ll n = stoi(S);
        //     if(i>=n) break;
        // }
    }
    bool ok;
    // cout << string_list <<endl;
    for(auto s:string_list){
        map<char, ll> s_count;
        bool has_zero = false;
        for(auto c:s){
            if(c=='0'){
                has_zero = true;
            }
            s_count[c]++;
        }
        if(has_zero){
            continue;
        }
        bool this_ok = true;
        // cout << s <<endl;
        // cout << s_count <<endl;
        for(auto p:s_count){
            // cout << p <<endl;
            if(counter[p.first]<p.second){
                this_ok = false;
                break;
            }
        }
        ok = this_ok;
        if(this_ok){
            break;
        }
    }
    if(ok){
        cout << "Yes" <<endl;
    }else{
        cout << "No" <<endl;
    }

}

int main(){
    Main();
}