#include<vector>
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<map>
#include<functional>
#include<queue>
#include<stack>
#include<string.h>
#include<list>
#define MOD 10000
#define INF 1000000000
#define MAX 101
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
int main() {
    string s;
    cin>>s;
    int sl=s.length();
    bool ans=true;
    bool f=true;
    for(int i=sl-1;i>=0;i--){
        if(i==sl-1){
            if(s[i]!='2'&&s[i]!='3'&&s[i]!='4'){
                
                ans=false;
                break;
            }
        }else{
            if(f){
                if(i==0){
                    if(s[i]!='1'&&s[i]!='8'&&s[i]!='7'){
                        ans=false;
                        break;
                    }
                }else if(s[i]!='3'&&s[i]!='4'&&s[i]!='5'){
                    if(s[i]=='7'||s[i]=='8'){
                        f=false;
                    }else{
                        ans=false;
                        break;
                    }
                }

            }else{
                if(s[i]!='6'&&s[i]!='7'){
                    ans=false;
                    break;
                }
            }
        }
    }
    if(ans){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}