#include <bits/stdc++.h>
using namespace std;
vector<string> split(const string& s, char c) {
  vector<string> v;
  stringstream ss(s);
  string x;
  while (getline(ss, x, c)) v.emplace_back(x);
  return move(v);
}
void err(vector<string>::iterator it) {}
template <typename T, typename... Args>
void err(vector<string>::iterator it, T a, Args... args) {
  cerr << it->substr((*it)[0] == ' ', it->length()) << " = " << a << "  ";
  err(++it, args...);
}
template <class T>
inline T bigmod(T p, T e, T M) {
  long long ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p) % M;
    p = (p * p) % M;
  }
  return (T)ret;
}
template <class T>
inline T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
template <class T>
inline T modinverse(T a, T M) {
  return bigmod(a, M - 2, M);
}
template <class T>
inline T bpow(T p, T e) {
  long long ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p);
    p = (p * p);
  }
  return (T)ret;
}
int main() {
  int b, f;
  string s, out = "NO";
  long long n = ({
    int a;
    scanf("%d", &a);
    a;
  });
  long long m = n / 1234567 + 1;
  long long m2 = n / 123456 + 1;
  long long m3 = n / 1234 + 1;
  for (__typeof(m) i = 0; i < m; ++i) {
    for (__typeof(m2) j = 0; j < m2; ++j) {
      long long f2 = i * 1234567LL + j * 123456LL;
      if (f2 > n) {
        break;
      }
      f2 = n - f2;
      if (f2 % 1234 == 0) {
        printf("YES\n");
        return 0;
      }
    }
  }
  printf("NO\n");
  return 0;
}
