#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, k, l, m;
  int small = 1234, med = 123456, large = 1234567;
  int the_no;
  cin >> the_no;
  for (i = 0; i <= the_no;) {
    for (j = 0; j + i <= the_no;) {
      if ((the_no - (j + i)) % small == 0) {
        cout << "YES";
        return 0;
      }
      j += med;
    }
    i += large;
  }
  cout << "NO";
  return 0;
}
