#include <bits/stdc++.h>
int main() {
  int n;
  scanf("%d", &n);
  for (int a = 0; a <= n; a += 1234567) {
    for (int b = 0; b <= n - a; b += 123456) {
      if ((n - a - b) % 1234 == 0) {
        printf("YES\n");
        return 0;
      }
    }
  }
  printf("NO\n");
  return 0;
}
