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