#include <bits/stdc++.h>
int main(void) {
  int n, flag = 0;
  long long i = 0;
  scanf("%d ", &n);
  while (i * 1234567 <= n) {
    long long j = 0;
    while (i * 1234567 + j * 123456 <= n) {
      if ((n - i * 1234567 - j * 123456) % 1234 == 0) flag = 1;
      j++;
    }
    i++;
  }
  if (flag)
    printf("YES\n");
  else
    printf("NO\n");
  return 0;
}
