#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
for (int a = 0; a <= n; a += 1234567) {
for (int b = 0; b <= n - a; b += 123456) {
if ((n - a - b) % 1234 == 0) {
cout << "YES";
return 0;
}
}
}
cout << "NO";
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluKCkgewogICAgaW50IG47CiAgICBjaW4gPj4gbjsKICAgIGZvciAoaW50IGEgPSAwOyBhIDw9IG47IGEgKz0gMTIzNDU2NykgewogICAgICAgIGZvciAoaW50IGIgPSAwOyBiIDw9IG4gLSBhOyBiICs9IDEyMzQ1NikgewogICAgICAgICAgICBpZiAoKG4gLSBhIC0gYikgJSAxMjM0ID09IDApIHsKICAgICAgICAgICAgICAgIGNvdXQgPDwgIllFUyI7CiAgICAgICAgICAgICAgICByZXR1cm4gMDsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KICAgIGNvdXQgPDwgIk5PIjsKCiAgICByZXR1cm4gMDsKfQ==