#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
#define EPS 1e-10
using namespace std;
typedef long long llong;
int city(char a) {
	switch (a) {
	case 'A':return 0;
	case 'B':return 1;
	case 'W':return 2;
	case 'X':return 3;
	case 'Y':return 4;
	case 'Z':return 5;
	default:return -1;
	}
}
vector<vector<int> >v(6, vector<int>(6, -1));
string s;
bool connect(int x=0,int y=0) {
	//cout << x << " " << y << endl;
	if (x == s.length() ) {
		if (y == city('B'))return true;
		else return false;
	}

	for (int j = 0; j < v[y].size(); j++) {
		if (v[y][j] == s[x] - '0') {
			return connect(x + 1, j);
		}
	}

	return false;
}



int main() {


	v[city('A')][city('X')] = 0;
	v[city('A')][city('Y')] = 1;
	v[city('B')][city('X')] = 1;
	v[city('B')][city('Y')] = 0;
	v[city('X')][city('Z')] = 1;
	v[city('Y')][city('X')] = 0;
	v[city('Z')][city('W')] = 0;
	v[city('Z')][city('B')] = 1;
	v[city('W')][city('B')] = 0;
	v[city('W')][city('Y')] = 1;

	while (cin >> s, s != "#") {
		if (connect())cout << "Yes" << endl;
		else cout << "No" << endl;
	}

	return 0;
}