#include #define pb push_back #define f first #define s second #define pii pair #define mp make_pair using namespace std; //ifstream fin("B.in"); const int MAX = 1e3 + 5; int v[MAX]; int cond[MAX]; string str; int main() { cin >> str; int n = str.size() / 8; for (int i = 0; i < n; i++) { if (str[i * 8] == '1') { v[i + 1] = 1; } else v[i + 1] = 0; if (v[i + 1]) { int cars = 0, j = (i + 1) * 8 - 1; while (j > i && str[j] == '0') { cars++; j--; } cond[i + 1] = cars; } } int i = 1; while (i <= n) { if (!v[i]) { cout << "No"; return 0; } //cout << cond[i]; int temp = i; i++; for (int j = 1; j <= cond[temp] && i <= n; j++, i++) { if (v[i]) { cout << "No"; return 0; } cond[temp]--; } //cout << cond[temp]; if (cond[temp]) { cout << "No"; return 0; } i++; } cout << "Yes"; return 0; }