#include <bits/stdc++.h>
using namespace std;

int main() {
    vector<vector<int>> g(6, vector<int>(2, -1));
    g[0][0] = 1;
    g[0][1] = 2;
    g[1][1] = 3;
    g[2][0] = 1;
    g[3][0] = 4;
    g[3][1] = 5;
    g[4][0] = 5;
    g[4][1] = 2;
    g[5][0] = 2;
    g[5][1] = 1;
    string path;
    while(cin >> path, path != "#") {
        bool ok = true;
        int now = 0;
        for(int i=0; i<path.size(); ++i) {
            int next = g[now][path[i] - '0'];
            if(next == -1) {
                ok = false;
                break;
            } else {
                now = next;
            }
        }
        if(ok && now == 5) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }
}