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