#include <bits/stdc++.h>
using namespace std;
bool chDiv(int n) {
  int luc[] = {4, 7, 44, 47, 74, 77, 444, 447, 474, 477, 744, 747, 774, 777};
  for (int i : luc) {
    if (n % i == 0) return true;
  }
  return false;
}
bool chInc(string s) {
  bool has4 = false, has7 = false, hasOt = false;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == '4')
      has4 = true;
    else if (s[i] == '7')
      has7 = true;
    else
      hasOt = true;
  }
  return (has4 && has7 && !hasOt) ? true : false;
}
bool solve(string s) {
  return (chDiv(atoi(s.c_str())) || chInc(s)) ? true : false;
}
int main() {
  string s;
  cin >> s;
  printf("%s\n", (solve(s) ? "YES" : "NO"));
  return 0;
}
