#include <iostream>
#include <string.h>

using namespace std;

char s[8*1111];

int type[8*1111];
int num[8*1111];

int main() {
    cin >> (s + 1);
    int n = strlen(s + 1);
    if (n % 8) {
        cout << "No";
        return 0;
    }
    int nr = 0;
    for (int i = 1; i <= n; i += 8) {
        if (s[i] == '1') {
            type[++nr] = 1;
            for (int j = i + 7; j >= i; --j)
                if (s[j] == '1')
                    break;
                else
                    ++num[nr];
        } else
            type[++nr] = 0;
    }
    bool sol = 1;
    int need = 0;
    for (int i = 1; i <= n; ++i)
        if (type[i] == 1 && need)
            sol = 0;
        else {
            if (type[i] == 1)
                need = num[i];
            else
                if (need > 0)
                    --need;
        }
    if (need)
        sol = 0;
    if (sol)
        cout << "Yes";
    else
        cout << "No";
    return 0;
}