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

int main() {
	string s;
	while (cin >> s) {
		if (s == "#")break;

		int now = 0;//axyzwbE

		for (int i = 0; i < s.size(); i++) {
			if (now == 6)break;

			if (now == 0) {
				if (s[i] == '0')now = 1;
				else now = 2;
			}
			else if (now == 1) {
				if (s[i] == '0')now = 6;
				else now = 3;
			}
			else if (now == 2) {
				if (s[i] == '0')now = 1;
				else now = 6;
			}
			else if (now == 3) {
				if (s[i] == '0')now = 4;
				else now = 5;
			}
			else if (now == 4) {
				if (s[i] == '0')now = 5;
				else now = 2;
			}
			else {
				if (s[i] == '0')now = 2;
				else now = 1;
			}
		}
		if (now == 5)cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	return 0;
}