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