#include <iostream>
#include <string>
using namespace std;
string s;

int carsFollowing(int i){
    int ret = 0, j = i+7;
    while(s[j] == '0') {
            ret++;
            j--;
    }
        return ret;
}
int main(){
    cin >> s;
    int cars = carsFollowing(0);
    int i = 8;
    bool ok = true;
    while(i < s.length() && ok){
        if(s[i] == '0'){
            if(cars == 0) ok = false;
            else cars--;
        }else{
            if(cars != 0) ok = false;
            else cars = carsFollowing(i);
        }
        i += 8;
    }
    if(ok) cout << "Yes";
    else cout << "No";
}