#include <bits/stdc++.h>
using namespace std;
long long n;
void Input() { cin >> n; }
void Solve() {
  for (long long i = 0; i <= (n / 1234567); i++) {
    for (long long j = 0; j <= (n / 123456); j++) {
      if ((i * 1234567 + j * 123456) <= n and
          (n - i * 1234567 - j * 123456) % 1234 == 0) {
        cout << "YES";
        return;
      }
    }
  }
  cout << "NO";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long T = 1;
  while (T--) {
    Input();
    Solve();
  }
  return 0;
}
