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