//lucky7

#include<bits/stdc++.h>
using namespace std;

int main ()
{
	//整数の入力
	int N;
	cin >> N;
	
	int a,b,c
	N = a*100 + b*10 +c

	//出力
	if((a%7 != 0) && (b%7 != 0) && (c%7 != 0)){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}

	return 0;
}