#include #include #include #include using namespace std; string v; bool st = false; int main() { cin >> v; if (v[v.size()-1] == '6' || v[v.size()-1] == '7') { cout << "No" << endl; return 0; } for (int i = v.size() - 1; i >= 0; i--) { if (i == 0) { if (v[i] == '0'||v[i]=='6'||v[i]=='7')cout << "Yes"; else cout << "No"; break; } if (v[i] >= '2'&&v[i] <= '4')v[i - 1]--; else if (v[i] == '6' || v[i] == '7') { for (; i >= 0; i--) { if (v[i] != '6'&&v[i] != '7') { cout << "No"; goto no; } } cout << "Yes"; no:; break; } else { cout << "No"; break; } } cout << endl; return 0; }