#include <bits/stdc++.h>
using namespace std;
long long n;
int main() {
  scanf("%I64d", &n);
  int na = 1234567, nb = 123456, nc = 1234;
  bool ok = 0;
  for (int a = 0; a * na <= n && (!ok); ++a) {
    int an = a * na;
    for (int b = 0; b * nb <= (n - an); ++b) {
      if ((n - (a * na + b * nb)) % nc == 0) {
        ok = 1;
        break;
      }
    }
  }
  if (ok)
    printf("YES");
  else
    printf("NO");
  return 0;
}
