#include <iostream>
using namespace std;
int d[10][10];
void init(){
  for(int i = 0; i < 6; i++)for(int j = 0 ; j < 6; j++)d[i][j] = -1;
  d[0][0] = d[5][1] = d[2][0] = 1;
  d[0][1] = d[4][1] = d[5][0] = 2;
  d[1][1] = 3;
  d[3][0] = 4;
  d[3][1] = d[4][0] = 5;
}
string s;
void solve(){
  int p = 0;
  for(int i = 0; i < (int)s.size(); i++){
    int b = s[i] - '0';
    p = d[p][b];
    if(p == -1)break;
  }
  cout << (p==5?"Yes":"No") << endl;
}
int main(){
  init();
  while(cin >> s && s != "#"){
    solve();
  }
}