#include <bits/stdc++.h>
using namespace std;
const int arr[4] = {1234567, 123456, 1234};
int n;
bool calc();
int main() {
  while (scanf("%d", &n) != EOF) {
    if (n < 1234)
      printf("NO\n");
    else
      printf("%s\n", (calc() ? "YES" : "NO"));
  }
  return 0;
}
bool calc() {
  for (int i = n / arr[0]; i >= 0; --i)
    for (int j = (n - i * arr[0]) / arr[1]; j >= 0; --j)
      if ((n - i * arr[0] - j * arr[1]) % arr[2] == 0) return true;
  return false;
}
