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