#include<iostream>
#include<string>
using namespace std;
int main() {
	string s;
	int pa[6] = { 2,3,-1,2,5,1 };
	int pb[6] = { 3,2,4,-1,1,3 };
	while (cin >> s){
		int mode = 0;
		//A:0 B:1 X:2 Y:3 Z:4 W:5
		if (s == "#")return 0;
		for (int i = 0; i < s.size(); i++) {
			if (s[i] == '0')mode = pa[mode];
			else if (s[i] == '1')mode = pb[mode];
			if (mode == -1)goto missing;
		}
		if (mode == 1)cout << "Yes\n";
		else {
		missing:cout << "No\n";
		}
	}
}