#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <climits>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <bitset>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define chmax(a,b) (a<(b)?(a=b,1):0)
#define chmin(a,b) (a>(b)?(a=b,1):0)
#define valid(y,x,h,w) (0<=y&&y<h&&0<=x&&x<w)
typedef long long ll;
typedef pair<int,int> pii;
const int INF = 1<<29;
const double PI = acos(-1);
const double EPS = 1e-8;

int g[6][2] = {
  1, 2,
  -1, 3,
  1, -1,
  4, 5,
  5, 2,
  2, 1
};

int main() {
  string s;
  while(cin >> s, s!="#") {
    int a = 0;
    FOR(it, s) {
      int k = *it - '0';
      if (g[a][k] == -1) {
        break;
      }
      a = g[a][k];
    }
    cout << (a == 5 ? "Yes" : "No")  << endl;
  }
}