#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  bool ok = false;
  for (int a = 0; a * 1234567 <= n; a++)
    for (int b = 0; b * 123456 <= n; b++) {
      if (a * 1234567 + b * 123456 > n) continue;
      int c = n - (a * 1234567 + b * 123456);
      if (c % 1234 == 0) ok = true;
    }
  puts(ok ? "YES" : "NO");
  return 0;
}
