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