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

int city[7][2] = { {0,0}, {2,3}, {0,4}, {2,0}, {5,6} , {6,3}, {3,2} };
string str;

int main(){
	while(cin >> str){
		int p = 1;
		if(str[0] == '#') break;
		for(int i = 0; i < str.size(); i++) p = city[p][str[i]-'0'];
		if(p == 6) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
}