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

int main(){
  int mp[6][2];
  for(int i=0;i<6;i++)
    for(int j=0;j<2;j++) 
      mp[i][j] = -1;

  mp[0][0] = 2;
  mp[0][1] = 3;
  mp[1][0] = 3;
  mp[1][1] = 2;
  mp[2][0] = -1;
  mp[2][1] = 4;
  mp[3][0] = 2;
  mp[3][1] = -1;
  mp[4][0] = 5;
  mp[4][1] = 1;
  mp[5][0] = 1;
  mp[5][1] = 3;

  string str;
  while(1) {
    cin >> str;
    if(str[0] == '#') break;


    int ima = 0;
    for(int i=0;i<str.size();i++) {
      ima = mp[ima][str[i]-'0'];
      if(ima == -1) break;
    }
    if(ima == 1) cout <<"Yes" << endl;
    else cout << "No" << endl;

  }

  return 0;

}