#include #include #include #include using namespace std; //ifstream in("c.in"); //ofstream out("c.out"); const int maxn = 1005; char T[maxn]; int main() { cin.getline(T + 1, maxn); int n = strlen(T + 1); int nr_masini = 0; for(int st = 1; st <= n; st += 8) { if(T[st] == '1') { if(nr_masini > 0) { cout << "No\n"; return 0; } for(int dr = st + 7; dr >= st; dr--) { if(T[dr] != '0') { nr_masini = st + 7 - dr; break; } } } else { if(nr_masini > 0) nr_masini--; else cout << "No\n"; } } if(nr_masini == 0) cout << "Yes\n"; else cout << "No\n"; return 0; }