#include <bits/stdc++.h>
using namespace std;
long long GCD(long long u, long long v) {
  while (v != 0) {
    long long r = u % v;
    u = v;
    v = r;
  }
  return u;
}
int n, a, b, c, r;
int main() {
  scanf("%d", &n);
  r = n;
  a = 0;
  while (n - a * 1234567 >= 0) {
    b = 0;
    while (n - a * 1234567 - b * 123456 >= 0) {
      r = n - a * 1234567 - b * 123456;
      c = r / 1234;
      if (c * 1234 == r) {
        printf("YES\n");
        return 0;
      }
      b++;
    }
    a++;
  }
  printf("NO\n");
  return 0;
}
