#include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef pair P; int dx[] = { 1, 0, -1, 0 }; int dy[] = { 0, 1, 0, -1 }; const ll MOD = 1000000007; const ll INF = 100000; string s; bool judge(){ int cnt = 0, cnt2 = 0; for (int i = 0; i < s.size(); i++){ if (s[i] == '9') return false; if (s[i] == '8') cnt++; if (s[i] == '1') cnt2++; } if (cnt > 1 || cnt2 > 1) return false; return true; } bool judge2(int L){ for (int i = L; i < s.size(); i++){ int d = s[i] - '0'; if (i == s.size() - 1){ if (d < 2 || 4 < d) return false; } else{ if (d < 3 || 5 < d) return false; } } return true; } int main(void){ cin >> s; if (!judge()){ cout << "No" << endl; return 0; } bool ans; if (s[0] == '1'){ if(s.size() == 1) ans = false; else ans = judge2(1); } else{ for (int i = 0; i < s.size(); i++){ int d = s[i] - '0'; if (d < 6){ if (s[i - 1] == '6') ans = false; else ans = judge2(i); break; } } } if (ans) cout << "Yes" << endl; else cout << "No" << endl; }