#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long x;
  cin >> x;
  for (long long i = 0; i <= 1000; i++) {
    for (long long j = 0; j <= 10000; j++) {
      long long g = i * 1234567 + j * 123456;
      long long m = (x - g) / 1234;
      double l = (double)((x - g) / 1234);
      long long d = (long long)(l);
      if (m == d && m >= 0 && g + m * 1234 == x) {
        cout << "YES" << endl;
        return 0;
      }
    }
  }
  cout << "NO" << endl;
  return 0;
}
