#include <bits/stdc++.h>
bool Check(int64_t n) {
  for (int64_t i = 0; i <= n; i += 1234567) {
    for (int64_t j = 0; i + j <= n; j += 123456) {
      if (((n - i - j)) % 1234 == 0) return true;
    }
  }
  return false;
}
int main() {
  int64_t n;
  std::cin >> n;
  std::cout << (Check(n) ? "YES" : "NO") << std::endl;
}
