#include <bits/stdc++.h>

using namespace std;

char a[1001];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> a;
    int sz = strlen(a);
    bool loc;
    int cnt, pos, cars = 0;
    for (int i = 8; i < sz; i += 8) {
        loc = (a[i - 8] == '1');
        if (!cars && loc) {
            pos = i - 1;
            while (a[pos] == '0' && pos >= i - 8)
                ++cars, --pos;
        }
        if (cars) {
            if (a[i] == '0')
                --cars;
            else {
                cout << "No\n";
                return 0;
            }
        }
    }
    cout << "Yes\n";
    return 0;
}