#include <bits/stdc++.h>
using namespace std;
int dx[] = {-1, 0, 1, 1, 1, 0, -1, -1}, dy[] = {-1, -1, -1, 0, 1, 1, 1, 0};
int cx[] = {1, 1, 2, 2, -1, -1, -2, -2}, cy[] = {2, -2, 1, -1, 2, -2, 1, -1};
template <class T>
int len(const T& c) {
  return (int)c.size();
}
long long stoi(string s) {
  long long n = 0;
  for (__typeof(len(s)) i = 0; i < (len(s)); i++)
    n = (n << 3) + (n << 1) + (s[i] - 48);
  return n;
}
string itos(long long n) {
  if (n == 0) return "0";
  string s;
  while (n) {
    s += (n % 10 + 48);
    n /= 10;
  }
  reverse((s).begin(), (s).end());
  return s;
}
int main() {
  ios_base::sync_with_stdio(false);
  long n;
  while (cin >> n) {
    long m, flag = 0, a = 0, tc = 0;
    long arr[] = {4, 7, 44, 77, 444, 777, 47, 74, 447, 474, 477, 774, 747, 744};
    m = n;
    while (m != 0) {
      a = m % 10;
      m /= 10;
      if (a == 4 || a == 7)
        flag = 0;
      else {
        flag = 1;
        break;
      }
    }
    for (__typeof(14) i = 0; i < (14); i++) {
      if (n % arr[i] == 0) {
        tc = 0;
        break;
      } else
        tc = 1;
    }
    if (tc == 0 || flag == 0)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
