#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, i, j, k, rem1 = 0, rem2, rem3, p = 0, temp, temp2;
  cin >> n;
  k = n;
  rem1 = k / 1234567;
  if (k % 1234567 == 0 && (k % 1234567) % 123456 == 0 &&
      ((k % 1234567) % 123456) % 1234 == 0)
    p = 1;
  for (i = 0; i <= rem1; i++) {
    temp = k - (1234567 * i);
    for (j = 0; j <= temp / 123456; j++) {
      temp2 = temp - (123456 * j);
      rem2 = temp2 % 1234;
      if (rem2 == 0) {
        p = 1;
        break;
      }
    }
  }
  if (p == 1) {
    cout << "YES" << endl;
  } else
    cout << "NO" << endl;
}
