#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>

#define reep(i,n,m) for(int i=(n);i<(m);i++)
#define rep(i,n) reep(i,0,n)

using namespace std;

char road[100][2] = {0};

int main(){
    string str;
    road['A'][0] = 'X';
    road['A'][1] = 'Y';

    road['X'][1] = 'Z';

    road['Z'][0] = 'W';
    road['Z'][1] = 'B';

    road['B'][0] = 'Y';
    road['B'][1] = 'X';

    road['W'][0] = 'B';
    road['W'][1] = 'Y';

    road['Y'][0] = 'X';
    while(cin>>str,str!="#"){
        char now_town = 'A';
        bool flg=true;
        rep(i,str.length()){
            int d = str[i]-'0';
            now_town = road[now_town][d];
            if(now_town==0){
                flg=false;
                break;
            }
        }

        if(now_town!='B'){
            flg=false;
        }

        if(flg){
            puts("Yes");
        }else{
            puts("No");
        }
    }
    return 0;
}