#include #include using namespace std; string S; bool I = false; int cx = 0; int main() { cin >> S; if (S[0] == '1') { I = true; cx = 1; } for (int i = cx; i < (int)S.size() - 1; i++) { if (I == false) { if (S[i] == '7')continue; if (S[i] == '6') { if (i == S.size() - 1)continue; if (S[i + 1] == '6' || S[i + 1] == '7' || S[i + 1] == '8')continue; cout << "No" << endl; return 0; } if (S[i] == '8') { if (i == S.size() - 1)continue; if (S[i + 1] == '3' || S[i + 1] == '4' || S[i + 1] == '5') { continue; } cout << "No" << endl; return 0; } if (S[i] == '3' || S[i] == '4' || S[i] == '5') { I = true; } else { cout << "No" << endl; return 0; } } if (I == true) { if (S[i] == '3' || S[i] == '4' || S[i] == '5') { continue; } else { cout << "No" << endl; return 0; } } } if (S[S.size() - 1] == '2' || S[S.size() - 1] == '3' || S[S.size() - 1] == '4') { cout << "Yes" << endl; } else { cout << "No" << endl; } return 0; }