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