#include <iostream>
using namespace std;
 
int main() {
  int N,a,b,c;
  cin >> N;
  a = N/100;
  b = N%100/10;
  c = N%10;
  if(a%7==0||b%7==0||c%7==0){
    cout << "Yes";
  }
  else{
    cout << "No";
  }
}