#include <bits/stdc++.h>
using namespace std;
int main() {
  bool key;
  char ch1, ch2, ch;
  int i, j, n, m, a, b, k, tc, cnt, res, total, num1, num2, store, num;
  {
    key = false;
    scanf("%d", &num);
    for (i = 0; i <= 810; i++)
      for (j = 0; j <= 8100; j++) {
        store = num - i * 1234567 - j * 123456;
        if (store >= 0 && store % 1234 == 0) {
          key = true;
          break;
        }
      }
    if (key)
      printf("YES");
    else
      printf("NO\n");
  }
  return 0;
}
