#include <cstdio>
#include <iostream>
#include <cstring>
#include <sstream>
using namespace std;
int t, n, x, y;
string s;
char buf[256];
FILE *in;
FILE *out;
string int2str(int n)
{
    stringstream ss; // create a stringstream
    ss << n; // add n to the stream
    return ss.str();
}


int main() {

            int p;
            //sprintf(buf, "%d.in", p);
            //in = fopen(buf, "w");
            //fprintf(in, "%d", p);
            //sprintf(buf, "%d.out", p);
            //out =  fopen(buf, "w");
            freopen("4.in","r", stdin);
            freopen("4.out","w", stdout);
            scanf("%d", &p);
            y=0;
            s = int2str(p);
            //cin >> s;
            n = s.length();

            if(n==1){
                x=s[0]-'0';
                if(x %8 ==0)
                   y=1;
            }
            else if(n==2){
                if((10*(s[0]-'0')+(s[1]-'0'))%8==0 || (10*(s[1]-'0')+(s[0]-'0'))%8==0)
                    y=1;
            }
            else{
                for(int i=0;i<n;i++){
                    for(int j=0;j<n;j++){
                        for(int k=0;k<n;k++){
                            if(i!=j && j!=k && k!=i){
                                x=100*(s[i]-'0')+10*(s[j]-'0')+(s[k]-'0');
                                if(x%8==0){
                                    y=1;
                                    break;
                                }
                            }
                        }
                        if(y==1)
                            break;
                    }
                    if(y==1)
                        break;
                }
            }
            if(y)
                //fprintf(out, "Yes\n");
                printf("Yes\n");

            else
                //fprintf(out, "No\n");
                 printf("No\n");

            //fclose(in);
            //fclose(out);

	return 0;
}