#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int d[6][2]={{2,3},{3,2},{-1,4},{2,-1},{5,1},{1,3}};
int main(void){
    while(1){
        string n;
        cin>>n;
        if(n=="#")break;
        int m=n.length();
        int now=0;
        for(int i=0;i<m;i++){
            now=d[now][n[i]-'0'];
            if(now==-1)break;
        }
        now==1 ? cout<<"Yes"<<endl : cout<<"No"<<endl;
    }
    return 0;
}