#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i <= 1000; ++i) {
    for (int j = 0; j <= 1000000; ++j) {
      long long v = 1234567LL * i + 123456LL * j;
      if (n - v >= 0 && (n - v) % 1234LL == 0) {
        puts("YES");
        return 0;
      }
    }
  }
  puts("NO");
  return 0;
}
