#include <bits/stdc++.h>
using namespace std;
long long n, a = 1234567, b = 123456, c = 1234;
int main() {
  cin >> n;
  for (int i = 0; i * a <= n; ++i) {
    for (int j = 0; i * a + j * b <= n; ++j) {
      if ((n - (i * a) - (j * b)) % c == 0) {
        cout << "YES";
        return 0;
      }
    }
  }
  cout << "NO";
  return 0;
}
