#include<iostream>

using namespace std;

#define rep(i, n) for (int i = 0; i < int(n); ++i)

int main() {
  int edge[6][2];
  edge[0][0] = 1;
  edge[0][1] = 2;
  edge[1][0] = -1;
  edge[1][1] = 3;
  edge[2][0] = 1;
  edge[2][1] = -1;
  edge[3][0] = 4;
  edge[3][1] = 5;
  edge[4][0] = 5;
  edge[4][1] = 2;
  edge[5][0] = 2;
  edge[5][1] = 1;
  string str;
  while (true) {
    cin >> str;
    if (str == "#") break;
    int pos = 0;
    try{
      rep (i, str.size()) {
	pos = edge[pos][str[i] - '0'];
	if (pos == -1) throw 1;
      }
      cout << (pos == 5 ? "Yes" : "No") << endl;
    } catch(int n) {
      cout << "No" << endl;
    }
  }
  return 0;
}