#include <bits/stdc++.h>
using namespace std;
void scanint(long long int &x);
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n;
  scanint(n);
  long long int a = 1234567;
  long long int b = 123456;
  long long int c = 1234;
  long long int i = 0;
  long long int j = 0;
  bool f = true;
  while (f) {
    long long int temp1 = i * a;
    if (temp1 > n) break;
    j = 0;
    while (f) {
      long long int temp2 = j * b + temp1;
      if (temp2 > n) break;
      if ((n - temp2) % c == 0) f = false;
      j++;
    }
    i++;
  }
  if (!f)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
void scanint(long long int &x) {
  register int c = getchar();
  x = 0;
  int neg = 0;
  for (; ((c < 48 || c > 57) && c != '-'); c = getchar())
    ;
  if (c == '-') {
    neg = 1;
    c = getchar();
  }
  for (; c > 47 && c < 58; c = getchar()) {
    x = (x << 1) + (x << 3) + c - 48;
  }
  if (neg) x = -x;
}
