#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define ll long long int ll mod = 1000000007; //typedef vector V; //typedef vector VV; //typedef vector VVV; int main() { string s; int under_num = 0; cin >> s; for (int i = 0; i < s.length(); i++) { if (((s[s.length() - i - 1]-'0')-under_num== 3)|| ((s[s.length() - i - 1] - '0') - under_num == 4)|| ((s[s.length() - i - 1] - '0') - under_num == 2)) { under_num = 1; } else if(((s[s.length() - i - 1] - '0') - under_num == 7)|| ((s[s.length() - i - 1] - '0') - under_num == 6)){ under_num = 0; } else if ((s[s.length() - i - 1] - '0') - under_num == 0 && i == s.length() - 1) { under_num = 0; } else { cout << "No" << endl; return 0; } } if(under_num==0)cout << "Yes"<< endl; else cout << "No" << endl; return 0; }