#include <bits/stdc++.h> using namespace std; const int nmax=1005; int lg,i,j; char a[nmax]; bool checked[nmax]; int trail (int poz) { int cars=0,h; for (h=poz;h<poz+8 && h<lg;h++) { if (a[h]=='1') cars=0; else cars++; } return cars; } int main() { int aux; cin.getline(a,nmax); lg=strlen(a); for (i=0;i<lg;i+=8) { if (a[i]=='1') { aux=trail(i); j=i+8; while (j<lg && aux>0) { if (a[j]=='1') { cout<<"No"; return 0; } checked[j]=1; j+=8; aux--; } if (aux>0) { cout<<"No"; return 0; } } if (a[i]=='0' && checked[i]==0) { cout<<"No"; return 0; } } cout<<"Yes"; return 0; }