#include <bits/stdc++.h>
using namespace std;
void run();
int main() {
  ios::sync_with_stdio(false);
  run();
}
long long const A = 1234567;
long long const B = 123456;
long long const C = 1234;
void run() {
  long long n;
  cin >> n;
  for (long long a = 0; a * A <= n; a++)
    for (long long b = 0; a * A + b * B <= n; b++)
      if ((n - a * A - b * B) % C == 0) {
        cout << "YES\n";
        return;
      }
  cout << "NO\n";
}
