#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define ll long long #define ld long double #define EPS 0.0000000001 #define INF 1e9 #define LINF (ll)INF*INF #define MOD 1000000007 #define rep(i,n) for(int i=0;i<(n);i++) #define loop(i,a,n) for(int i=a;i<(n);i++) #define all(in) in.begin(),in.end() #define shosu(x) fixed< vi; typedef vector vs; typedef pair pii; int gcd(int a, int b){ if(b==0) return a; return gcd(b,a%b); } int lcm(int a, int b){ return a*b/gcd(a,b); } signed main(void) { string s; cin >> s; int n = s.size(); reverse(all(s)); if('2' > s[0] || s[0] > '4'){ cout << "No" << endl; return 0; } int c = 1; int num = 2; loop(i,1,n){ int t = s[i] - '0'; if(num && (t == 6+c || t == 7+c)){ c = 0; num = 1; }else if(num == 2 && t >= 2+c && t <= 4+c){ c = 1; }else if(num && c == 1 && t == 1){ c = 0; num = 0; }else{ cout << "No" << endl; return 0; } } if(c) cout << "No" << endl; else cout << "Yes" << endl; }