#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) {
    return a;
  }
  return gcd(b, a % b);
}
int main() {
  long long int n;
  scanf("%lld", &n);
  double a = 1234567;
  double b = 123456;
  for (int i = 0; i <= 100; i++) {
    for (int j = 0; j <= 1000; j++) {
      double x = (n - (b * j + a * i)) / (double)1234;
      long long y1 = ceil(x);
      long long y2 = floor(x);
      if (y1 == y2) {
        if (x >= 0 && y1 >= 0 && y2 >= 0) {
          printf("YES");
          return 0;
        }
      }
    }
  }
  printf("NO\n");
  return 0;
}
