#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

string in;

bool check(){
  int p = 0;
  int edge[6][2] = {{1, 3}, {-1, 2}, {4, 5}, {1, -1}, {5, 3}, {3, 1}};
  for(int i=0;i<in.size();i++){
    p = edge[p][in[i]-'0'];
    if(p == -1) return false;
  }
  return p == 5;
}

int main(){
  while(cin >> in){
    if(in == "#") break;
    cout << (check() ? "Yes" : "No") << endl;
  }
}