#include <iostream>
#include <string>
#include <vector>

#define rep(i,n) for(int i=0; i <(n); i++)

using namespace std;

int main(void){

    //input
    int N;
    cin >> N;

    //output
    string ans = "No";

    int N1 = N % 10;
    if( (N1 % 7) == 0) ans = "Yes";

    N = N / 10;
    int N10 = N % 10;
    if(N10 % 7 == 0) ans = "Yes";

    N = N / 10;
    int N100 = N % 10;
    if(N100 % 7 == 0) ans = "Yes";
        
    cout << ans;

    return 0;
}
