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