#include <iostream>
using namespace std;

int main()
{
	char *v = new char[8];
	cin >> v[0];
	int count;
	if(v[0] == '1'){

		count = 0;
		cin >> v[1]  >> v[2] >> v[3] >> v[4] >> v[5] >> v[6] >> v[7];
		int ind = 7;
		while (v[ind] == "0") {
			count++;
			ind--;
			if(ind == -1) break;
		}
		for(int i = 0; i < count; i++){
			cin >> v[0] >> v[1]  >> v[2] >> v[3] >> v[4] >> v[5] >> v[6] >> v[7];
			if (v[0] != "0") {
				cout<< "No";
				return 0;
			}
		}
	}
	else cout << "No";
cout << "Yes";
}