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