#include #include #include #include #include #include #include using namespace std; int n, a[20009], b[20009]; string s; int main() { cin >> s; n = s.size(); for (int i = 0; i < n; i++) a[n - i - 1] = s[i] - 48; bool ret = false; for (int i = 1; i < n; i++) { for (int j = 0; j <= n; j++) b[j] = a[j]; for (int j = 0; j < i; j++) b[j] -= 12; for (int j = i; j < (i == n - 1 ? n - 1 : n); j++) b[j] -= 6; for (int j = 0; j < n; j++) { int d = 0; if (b[j] < 0) d = (-b[j] + 9) / 10; b[j] += d * 10; b[j + 1] -= d; } if (b[n] >= 0) { bool f = true; for (int j = 0; j < i; j++) { if (b[j] >= 3) f = false; } for (int j = i; j < n; j++) { if (b[j] >= 2) f = false; } if (f) ret = true; } } cout << (ret ? "Yes" : "No") << endl; return 0; }