#include <bits/stdc++.h>
using namespace std;
using LL = long long;
const int N = 1005;
int in[N][N], row[N], col[N];
int main() {
  LL n;
  cin >> n;
  for (int a = 0;; a++) {
    LL A = a * 1234567LL;
    if (A > n) break;
    for (int b = 0;; b++) {
      LL B = b * 123456LL;
      if (A + B > n) break;
      LL m = n - A - B;
      if (m % 1234 == 0) return !printf("YES");
    }
  }
  puts("NO");
}
