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

typedef struct node{
	int z,o;
}Node;

Node no[7] = { {1,2},{6,3},{1,6},{4,5},{5,2},{2,1},{6,6} };
string p;

bool ok(string str){
	int l = 0;
	for(int i = 0; i < str.size(); i++){
		if(str[i] == '0'){
			l = no[l].z;
		}
		else{
			l = no[l].o;
		}
	}
	return l == 5;
}

int main(){
	while(cin >> p && p != "#"){
		cout << (ok(p) ? "Yes" : "No") << endl;
	}
	return 0;
}