#include <bits/stdc++.h>
using namespace std;
int main() {
  string str;
  cin >> str;
  int s = str.size();
  int c = 0;
  for (int i = 0; i < s; i++) {
    if (str[i] == '4' || str[i] == '7') c++;
  }
  int num = atoi(str.c_str());
  if (c == s)
    cout << "YES" << endl;
  else if (num % 4 == 0 || num % 7 == 0 || num % 47 == 0)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
