#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, flag = 0, a = 1234567, b = 123456, c = 1234, count1 = 0,
               count2 = 0, count3 = 0;
  cin >> n;
  while ((n - count1 * a >= 0) && flag == 0) {
    count2 = (n - (count1 * a));
    count3 = 0;
    while ((count2 - count3 * b >= 0) && flag == 0) {
      long long var = (count2 - (count3 * b));
      if (var % c == 0) {
        flag = 1;
      }
      count3++;
    }
    count1++;
  }
  if (flag == 1) {
    cout << "YES\n";
  } else {
    cout << "NO\n";
  }
  return 0;
}
