#include #include #include #include #include #include #include using namespace std; int main() { string p; cin >> p; int n = p.size(); int b = 0, s = 0, c = 0; for (int i = n - 1; i >= 0; i--) { int k = p[i] - '0' - c; if (s == 0) { if (k < 2 || 4 < k) { if (k == 6 || k == 7) { if (i == n - 1) b = 1; s = 1; c = 0; } else if (k == 0) { if (i != 0) b = 1; c = 0; } else { b = 1; } } else { c = 1; } } else { if (k == 6 || k == 7) { c = 0; } else { b = 1; } } } cout << (b == 0 && c == 0 ? "Yes" : "No") << endl; return 0; }