#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MAX = 1e9 + 1;
const long long int Pinf = INT_MAX, Ninf = INT_MIN;
const long int mod = 1e9 + 7;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char* x) { cerr << '\"' << x << '\"'; }
void __print(const string& x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V>& x) {
  cerr << '{';
  __print(x.first);
  cerr << ',';
  __print(x.second);
  cerr << '}';
}
template <typename T>
void __print(const T& x) {
  int f = 0;
  cerr << '{';
  for (auto& i : x) cerr << (f++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
template <typename T>
void print(vector<T> v) {
  for (T i : v) cout << i << " ";
  cout << '\n';
}
template <typename T>
void print(vector<vector<T>>& v) {
  for (vector<T>& vv : v) {
    for (T& i : vv) cout << i << " ";
    cout << '\n';
  }
}
template <typename T>
void read(vector<T>& v) {
  for (T& i : v) cin >> i;
}
template <typename T>
void read(T&& t) {
  cin >> t;
}
template <typename T, typename... Args>
void read(T&& t, Args&&... args) {
  cin >> t;
  read(forward<Args>(args)...);
}
template <typename T>
void print(T&& t) {
  cout << t << '\n';
}
template <typename T, typename... Args>
void print(T&& t, Args&&... args) {
  cout << t << " ";
  print(forward<Args>(args)...);
}
bool isPrime(ll n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (ll i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
ll binpow(ll a, ll b, ll m) {
  a %= m;
  ll res = 1;
  while (b > 0) {
    if (b & 1) res = (res * a) % m;
    a = (a * a) % m;
    b >>= 1;
  }
  return res;
}
ll to_int(string str) {
  ll n = str.size(), num = 0;
  for (int i = 0; i < n; i++) {
    num = num * 10 + (str[i] - '0');
  }
  return num;
}
ll gcd(ll a, ll b) {
  if (b % a == 0) return a;
  return gcd(b % a, a);
}
ll lcm(ll a, ll b) { return (a / gcd(a, b) * b); }
map<ll, ll> primeFactors(ll n) {
  map<ll, ll> m;
  while (n % 2 == 0) {
    m[2]++;
    n = n / 2;
  }
  for (ll i = 3; i <= sqrt(n); i = i + 2) {
    while (n % i == 0) {
      m[i]++;
      n = n / i;
    }
  }
  if (n > 2) m[n]++;
  return m;
}
vector<ll> allFactors(ll n) {
  vector<ll> arr;
  for (int i = 2; i <= sqrt(n); i++) {
    if (n % i == 0) arr.push_back(i), arr.push_back(n / i);
  }
  return arr;
}
int getLenDigit(ll n) {
  int len = 0;
  while (n > 0) {
    len++;
    n /= 10;
  }
  return len;
}
int main() {
  ll n;
  cin >> n;
  int x = 1234567, y = 123456, z = 1234;
  if (n % x == 0 or n % y == 0 or n % z == 0) {
    cout << "YES" << endl;
    return 0;
  }
  int a = n / x;
  int b = n / y;
  for (int i = 0; i <= a; i++) {
    for (int j = 0; j <= b; j++) {
      int c = n - ((x * i) + (y * j));
      if (c >= 0 and c % z == 0) {
        cout << "YES" << endl;
        return 0;
      }
    }
  }
  cout << "NO" << endl;
}
