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