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