#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt"
int main() {
	int a[7][2];
	a[0][0] = 1;
	a[0][1] = 4;
	a[1][0] =6;
	a[1][1] = 2;
	a[2][0] = 5;
	a[2][1] = 3;
	a[3][0] = 4;
	a[3][1] = 1;
	a[4][0] = 1;
	a[4][1] = 6;
	a[5][0] = 3;
	a[5][1] = 4;
	a[6][0] = 6;
	a[6][1] = 6;

	while (1) {

		string st; cin >> st;
		if (st == "#")break;
		else {
			int now = 0;
			for (auto c : st) {
				int aa = c - '0';
				now = a[now][aa];
			}
			if (now == 3) {
				cout << "Yes" << endl;
			}
			else {
				cout << "No" << endl;
			}
		}
	}

	return 0;
}