#include <bits/stdc++.h>
using namespace std;
int main() {
  long int n;
  string st;
  cin >> st;
  stringstream ss;
  ss << st;
  ss >> n;
  int counter = 0;
  int lastdigit;
  for (int i = 0; i < st.length(); i++) {
    if (st[i] == '4' || st[i] == '7') {
      counter++;
    }
  }
  if (counter == st.length() || n % 4 == 0 || n % 7 == 0 || n % 47 == 0 ||
      n % 74 == 0) {
    cout << "YES";
  } else {
    cout << "NO";
  }
  return 0;
}
