#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d;
  char arr[1000];
  cin >> arr;
  b = 0;
  c = 0;
  for (a = 0; a < strlen(arr); a++) {
    if (arr[a] == '4') {
      b++;
    } else if (arr[a] == '7') {
      c++;
    } else if (arr[a] != '4' || arr[a] != '7') {
      b = 0;
      c = 0;
      break;
    }
  }
  if (b == 0 || c == 0) {
    d = atoi(arr);
    if (d % 4 == 0 || d % 7 == 0 || d % 47 == 0 || d % 74 == 0) {
      cout << "YES" << endl;
    } else
      cout << "NO" << endl;
  } else if (b != 0 && c != 0) {
    cout << "YES" << endl;
  }
}
