#include <bits/stdc++.h>
int main(void) {
  long long a = 1234567, b = 123456, c = 12345, num;
  long long d, e, i, j, k, l, f, flag = 0, g, num1;
  scanf("%lld", &d);
  e = d / a;
  while (e >= 0) {
    num = d - (e * 1234567);
    f = num / b;
    while (f >= 0) {
      num1 = num - (f * 123456);
      g = num1 % 1234;
      while (g >= 0) {
        if (num1 % 1234 == 0) {
          printf("YES\n");
          flag = 1;
          goto end;
        }
        g--;
      }
      f--;
    }
    e--;
  }
end:
  if (flag == 0) printf("NO\n");
  return 0;
}
