#include <iostream>
#include <cstring>
#include <fstream>
#define NMAX 8003

using namespace std;
/*ifstream fin("date.in");
ofstream fout("date.out");*/
int n;
char v[NMAX];
bool check(int i);
int main()
{
	cin >> v;
	int i;
	int lg = strlen(v);
	int cars=0;
	for (i = 0; i < lg; i+=8)
	{
		if (v[i] == '1')
		{
			if (cars)
			{
				cout << "No" << '\n';
				return 0;
			}
			else
			{
				int j = i + 7;
				while (v[j] == '0')
				{
					cars++;
					j--;
				}
			}
			//i += 8;
		}
		else
		{
			cars--;
			if (cars < 0)
			{
				cout << "No" << '\n';
				return 0;
			}
		}
	}
	if (cars)
		cout << "No" << '\n';
	else
		cout << "Yes" << '\n';
	return 0;
}