#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, i, j, k, c = 0, r = 0;
  cin >> n;
  for (i = 0; i <= 100; i++) {
    for (j = 0; j <= 1000; j++) {
      long long s = j * 123456 + i * 1234567;
      long long baki = n - s;
      if (baki >= 0 && baki % 1234 == 0) {
        cout << "YES" << endl;
        return 0;
      }
    }
  }
  cout << "NO" << endl;
  return 0;
}
