#include using namespace std; int main() { // assert(freopen("bytetrains.in", "r", stdin)); // assert(freopen("bytetrains.out", "w", stdout)); cin.sync_with_stdio(false); string S; cin >> S; int N = (int) S.size(); for (int i = 0; i < N; i += 8) { if (S[i] == '1') { int need = 0; for (int j = i + 7; j > i && S[j] == '0'; j--) { need++; } int j = i + 8; while (need > 0 && j < N && S[j] == '0') { need--; j += 8; } i = j - 8; if (need > 0) { cout << "No" << endl; return 0; } } } cout << "Yes" << endl; return 0; }