#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
vector<int>freq(10);
int len=3;
bool possible=false;
void recur(int pos,vector<int>&cnt,int num) {
    if(pos==len) {
        if(num%8==0) possible=true;
        return;
    }
    for(int i=1;i<=9;i++) {
        if(freq[i]==0 or cnt[i]==freq[i]) continue;
        cnt[i]++;
        recur(pos+1,cnt,num*10+i);
        cnt[i]--;
    }
}
int main(int argc, char const *argv[]) {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(0);
    string s; cin>>s;
    int n=s.size();
    len=min(len,n);
    for(auto x:s)  freq[x-'0']++;
    vector<int>cnt(10);
    recur(0,cnt,0);
    cout<<(possible?"Yes":"No")<<endl;
}
//Hachi 

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define nvarep(n,a) ll n;cin>>n;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define vecrep(n,a,type) vector<type>a(n);rep(i,0,n)cin>>a[i]
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define nnn "\n"
#define spa " "
using P = pair<ll,ll>;
using graph = vector<vector<ll>>;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

signed main (){
    string s;cin>>s;
    string g=s;
    reverse(range(g));
    vector<int>t(10,0);
    rep(i,0,s.size())t[s[i]-'0']++;
    if(s.size()<3)t[0]+=3-s.size();
    rep(i,0,125){
        int f=i*8;
        string d=to_string(f);
        vector<int>r(10,0);
        if(d.size()<3)r[0]+=3-d.size();
        for(auto e:d)r[e-'0']++;
        bool flag=true;
        rep(j,0,10){
            if(r[j]>t[j])flag=false;
        }
        if(s.size()<3)if(r[0]>0&&(stoi(s)%8!=0)&&(stoi(g)%8!=0))flag=false;
        if(flag){
            cout<<"Yes"<<nnn;
            return 0;
        }
    }
    cout<<"No"<<nnn;
    return 0;
}