#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long a = 1234567, b = 123456, c = 1234;
  long long ck = 0;
  for (long long i = 0; i * a <= n; i++) {
    for (long long j = 0; (i * a) + (j * b) <= n; j++) {
      long long x = n - (i * a) - (j * b);
      if (x % c == 0) {
        ck = 1;
        cout << "YES" << endl;
        return 0;
      }
    }
  }
  if (ck == 0) {
    cout << "NO" << endl;
    return 0;
  }
  return 0;
}
