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