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