#include <bits/stdc++.h>
using namespace std;
void scan(int &n) {
  int sign = 1;
  n = 0;
  char c = getchar_unlocked();
  while (c < '0' || c > '9') {
    if (c == '-') sign = -1;
    c = getchar_unlocked();
  }
  while (c >= '0' && c <= '9')
    n = (n << 3) + (n << 1) + c - '0', c = getchar_unlocked();
  n = n * sign;
}
void lscan(long long int &n) {
  int sign = 1;
  n = 0;
  char c = getchar_unlocked();
  while (c < '0' || c > '9') {
    if (c == '-') sign = -1;
    c = getchar_unlocked();
  }
  while (c >= '0' && c <= '9')
    n = (n << 3) + (n << 1) + c - '0', c = getchar_unlocked();
  n = n * (long long int)(sign);
}
int sscan(char a[]) {
  char c = getchar_unlocked();
  while (c == ' ' || c == '\n') c = getchar_unlocked();
  int i = 0;
  while (c != '\n') a[i++] = c, c = getchar_unlocked();
  a[i] = 0;
  return i;
}
int wscan(char a[]) {
  char c = getchar_unlocked();
  while (c == ' ' || c == '\n') c = getchar_unlocked();
  int i = 0;
  while (c != '\n' && c != ' ') a[i++] = c, c = getchar_unlocked();
  a[i] = 0;
  return i;
}
void print(int n) {
  if (n < 0) {
    n = -n;
    putchar_unlocked('-');
  }
  int i = 10;
  char o[10];
  do {
    o[--i] = (n % 10) + '0';
    n /= 10;
  } while (n);
  do {
    putchar_unlocked(o[i]);
  } while (++i < 10);
}
void lprint(long long int n) {
  if (n < 0LL) {
    n = -n;
    putchar_unlocked('-');
  }
  int i = 21;
  char o[21];
  do {
    o[--i] = (n % 10LL) + '0';
    n /= 10LL;
  } while (n);
  do {
    putchar_unlocked(o[i]);
  } while (++i < 21);
}
void sprint(const char a[]) {
  const char *p = a;
  while (*p) putchar_unlocked(*p++);
}
long long int po(long long int a, long long int b, long long int m) {
  long long int x = 1, y = a;
  while (b > 0) {
    if (b % 2 == 1) {
      x = (x * y);
      if (x > m) x %= m;
    }
    y = (y * y);
    if (y > m) y %= m;
    b /= 2;
  }
  return x;
}
const long long int MOD = 1000000007LL;
const int siz = 150;
int main() {
  int n;
  int x = n / 1234567, y = n / 123456;
  int i, j, a = -1, p, q;
  cin >> n;
  for (i = 0; i <= x; i++) {
    p = i * 1234567;
    p = n - p;
    for (j = 0; j <= y; j++) {
      q = p - (j * 123456);
      if (q < 0) break;
      if (!(q % 1234)) {
        a = 1;
        break;
      }
    }
    if (a != -1) break;
  }
  if (a != -1)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
