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