#include <bits/stdc++.h>
int main() {
  int n;
  scanf("%d", &n);
  int n1 = n, dig, x = 0, y = 0, z = 0, r;
  while (n1 > 0) {
    dig = n1 % 10;
    if (dig != 4 && dig != 7) {
      x++;
      break;
    }
    n1 = n1 / 10;
  }
  if (x == 0) {
    printf("YES");
    z++;
  } else if (x > 0) {
    for (int i = 1; i < n; i++) {
      y = 0;
      n1 = i;
      while (n1 > 0) {
        dig = n1 % 10;
        if (dig != 4 && dig != 7) {
          y++;
          break;
        }
        n1 = n1 / 10;
      }
      if (y == 0 && n % i == 0) {
        printf("YES");
        z++;
        break;
      }
    }
  }
  if (z == 0) {
    printf("NO");
  }
  return 0;
}
