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