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

int main()
{
	string s;

	cin >> s;

	while (s != "#") {
		int p;
		if (s[0] == '0')
			p = 0;
		else
			p = 1;

		for (int i = 1; i < s.size(); i++) {
			if (p == 0) {
				if (s[i] == '1')
					p = 2;
				else
					p = 5;
			}
			else if (p == 1) {
				if (s[i] == '0')
					p = 0;
				else
					p = 5;
			}
			else if (p == 2) {
				if (s[i] == '1')
					p = 4;
				else
					p = 3;
			}
			else if (p == 3) {
				if (s[i] == '1')
					p = 1;
				else
					p = 4;
			}
			else if (p == 4) {
				if (s[i] == '1')
					p = 0;
				else
					p = 1;
			}
		}

		if (p == 4)
			cout << "Yes" << endl;
		else
			cout << "No" << endl;

		cin >> s;
	}

	return 0;
}

