#include //#define fin cin //#define fout cout #define F first #define S second using namespace std; typedef long long ll; int n , i , j , cars; char s[8010]; int main() { #ifndef ONLINE_JUDGE freopen("input.in","r",stdin); freopen("output.out","w",stdout); #endif // ONLINE_JUDGE /* #ifndef ONLINE_JUDGE ifstream fin("input.in"); ofstream fout("output.out"); #endif // ONLINE_JUDGE */ gets(s+1); n = strlen(s+1); for (i = n - 7; i > 0; i -= 8) { if (s[i] == '0') cars++; else { j = i + 7; int zeros = 0; while (s[j] == '0') zeros++, j--; if (cars != zeros) { printf("No\n"); return 0; } cars = 0; } } printf("Yes\n"); return 0; return 0; }