#include <bits/stdc++.h>
using namespace std;
long long n, a, b, c;
int f(long long n) {
  for (a = 0; a <= 820; a++) {
    for (b = 0; b <= 8200; b++) {
      c = n - a * 1234567 - b * 123456;
      if (c >= 0 && c % 1234 == 0) {
        return 1;
      }
    }
  }
  return 0;
}
int main() {
  while (cin >> n) {
    if (f(n))
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
