#include <iostream>
#include <string>
using namespace std;
void fast_io(){
ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
#ifndef ONLINE_JUDGE
//freopen("input.txt", "r", stdin);
#endif
}
int main()
{
fast_io();
int num;
cin >> num;
int temp = num;
int counter = 0;
int digits = 0;
while (temp > 0){
temp /= 10;
digits++;
}
temp = num;
while (temp > 0){
if (temp%10 == 4 || temp%10 == 7 ){
temp /= 10;
counter++;
}else{
break;
}
}
if (counter == digits){
cout << "YES";
}else{
if (num%7 == 0 || num%4 == 0){
cout << "YES";
}else{
cout << "NO";
}
}
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCnZvaWQgZmFzdF9pbygpewogICAgaW9zX2Jhc2U6OnN5bmNfd2l0aF9zdGRpbyhmYWxzZSksIGNpbi50aWUobnVsbHB0ciksIGNvdXQudGllKG51bGxwdHIpOwogICAgI2lmbmRlZiBPTkxJTkVfSlVER0UKICAgICAgICAvL2ZyZW9wZW4oImlucHV0LnR4dCIsICJyIiwgc3RkaW4pOwogICAgI2VuZGlmCn0KCmludCBtYWluKCkKewogICAgZmFzdF9pbygpOwogICAgaW50IG51bTsKICAgIGNpbiA+PiBudW07CiAgICBpbnQgdGVtcCA9IG51bTsKICAgIGludCBjb3VudGVyID0gMDsKICAgIGludCBkaWdpdHMgPSAwOwogICAgd2hpbGUgKHRlbXAgPiAwKXsKICAgICAgICB0ZW1wIC89IDEwOwogICAgICAgIGRpZ2l0cysrOwogICAgfQogICAgdGVtcCA9IG51bTsKICAgIHdoaWxlICh0ZW1wID4gMCl7CiAgICAgICAgaWYgKHRlbXAlMTAgPT0gNCB8fCB0ZW1wJTEwID09IDcgKXsKICAgICAgICAgICAgdGVtcCAvPSAxMDsKICAgICAgICAgICAgY291bnRlcisrOwogICAgICAgIH1lbHNlewogICAgICAgICAgICBicmVhazsKICAgICAgICB9CiAgICB9CiAgICBpZiAoY291bnRlciA9PSBkaWdpdHMpewogICAgICAgIGNvdXQgPDwgIllFUyI7CiAgICB9ZWxzZXsKICAgICAgICBpZiAobnVtJTcgPT0gMCB8fCBudW0lNCA9PSAwKXsKICAgICAgICAgICAgY291dCA8PCAiWUVTIjsKICAgICAgICB9ZWxzZXsKICAgICAgICAgICAgY291dCA8PCAiTk8iOwogICAgICAgIH0KICAgIH0KCn0=