#include #define REP(i,n) for(int i=0;i<(n);i++) #define ALL(v) (v).begin(),(v).end() #define int long long #define INF 1e18 #define SIZE 200005 using namespace std; typedef pair P; //----------------------------------------------------------------------- int a[SIZE]; signed main() { cin.tie(0); ios::sync_with_stdio(false); string s; cin>>s; int N=s.size(); REP(i,N) a[i]=s[i]-'0'; bool f=true; for(int i=N-1;i>=0;i--) { if(i==0){ if(a[i]!=0) f=false; break; } if(a[i]==2||a[i]==3||a[i]==4){ a[i-1]--; continue; } else if(a[i]==6||a[i]==7){ for(int j=i;j>=0;j--) if(a[j]!=6 && a[j]!=7) f=false; } else{ f=false; } break; } cout<<(f?"Yes":"No")<