#include <bits/stdc++.h>
using namespace std;
int main() {
  long long A = 1234567LL;
  long long B = 123456LL;
  long long C = 1234LL;
  long long n;
  scanf("%I64d", &n);
  for (long long i = 0; i * A <= n; ++i) {
    for (long long j = 0; i * A + j * B <= n; ++j) {
      if (((n - i * A - j * B) % C) == 0) {
        printf("YES\n");
        return 0;
      }
    }
  }
  printf("NO\n");
  return 0;
}
