#include<iostream>
#include<math.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
int main() {
	int n;
	cin >> n;
	int x = n / 100;
	int y = (n / 10)%10;
	int z = n % 10;
	
	if (x % 7 == 0 || y % 7 == 0 || z % 7 == 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}