#include #define show(x) std::cerr << #x << " = " << x << std::endl int main() { std::string p; std::cin >> p, std::reverse(p.begin(), p.end()); const int sz = p.size(); auto in = [](const int target, const int inf, const int sup) { return inf + '0' <= target and target <= sup + '0'; }; auto judge = [&]() { if (not in(p[0], 2, 4)) { return false; } int pos = 1; for (; pos < sz and in(p[pos], 3, 5); pos++) {} if (pos == sz) { return false; } if (p[pos] == '1') { return pos == sz - 1; } else if (not in(p[pos], 7, 8)) { return false; } pos++; for (; pos < sz and in(p[pos], 6, 7); pos++) {} return pos == sz; }; std::cout << (judge() ? "Yes" : "No") << std::endl; return 0; }