#include #include #include #include #include #include #include using namespace std; int main(){ string s; cin >> s; int last = s[s.length() - 1] - '0'; if (!(last == 2 || last == 3 || last == 4)){ cout << "No" << endl; return 0; } bool c = true; int current; for (int i = s.length() - 2; i>-1; i--) { current = s[i] - '0'; if(!c) { if (!(current == 6 || current == 7)) { cout << "No" << endl; return 0; } } else { if (!(current == 3 || current == 4 || current == 5)) { if (i==0 && (current == 7 || current == 8 || current == 1)) { cout << "Yes" << endl; return 0; } else if (i==0) { cout << "No" << endl; return 0; } c = false; } } } cout << "Yes" << endl; }