// includes {{{
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<random>
#include<cassert>
#include<bitset>
#include<cstdlib>
// #include<deque>
// #include<multiset>
// #include<cstring>
// #include<bits/stdc++.h>
// }}}
using namespace std;
using ll = long long;

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

int main() {
  std::ios::sync_with_stdio(false), std::cin.tie(0);
  string s;
  while(1) {
    cin >> s;
    if(s == "#") break;
    int now = 0;
    for(auto c : s) {
      now = g[now][c-'0'];
      if(now == -1) break;
    }
    if(now == 5) cout << "Yes" << "\n";
    else cout << "No" << "\n";
  }
  return 0;
}

