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