#include <bits/stdc++.h>
using namespace std;
const long double pi = acos(-1);
const int MOD = 1e9 + 7;
const long long int INF = 100000000000000000LL;
long long int a1 = 1234567;
long long int b1 = 123456;
long long int c1 = 1234;
bool solve(int a) {
  if (a % c1 == 0) return true;
  return false;
}
bool solve1(int v) {
  int tmp = 0;
  while (tmp <= v) {
    if (solve(v - tmp)) {
      return true;
    }
    tmp += b1;
  }
  return false;
}
int main() {
  long long int aux = 0;
  long long int n;
  cin >> n;
  bool ok = false;
  while (aux <= n) {
    if (solve1(n - aux)) {
      ok = true;
      break;
    }
    aux += a1;
  }
  if (ok) {
    cout << "YES"
         << "\n";
  } else
    cout << "NO"
         << "\n";
  return 0;
}
