#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  bool answer = false;
  long long bound = n / 1234567;
  for (long long i = 0; i <= bound; i++) {
    long long temp = (n - i * 1234567) / 123456;
    for (long long j = 0; j <= temp; j++) {
      long long x = n - i * 1234567 - j * 123456;
      if (x % 1234 == 0) {
        answer = true;
        break;
      }
    }
    if (answer == true) break;
  }
  if (answer == true)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
