#include #include #include #include #include using namespace std; int main() { string s; cin >> s; int carry = 0; int bad = 0; for (int i = s.size() - 1; i >= 0; i--) { for (int x : {0, 6, 7}) { for (int y : {0, 6, 7}) { if (i == 0 && (x == 0 || y == 0)) continue; if (bad == 1 && y != 0) continue; if (bad == 2 && (x != 0 || y != 0)) continue; if ((x + y + carry) % 10 == s[i] - '0') { if (x == 0) bad++; if (y == 0) bad++; carry = (x + y + carry) / 10; goto LP; } } } cout << "No" << endl; return 0; LP:; } if (carry == 0) { cout << "Yes" << endl; } else { cout << "No" << endl; } }