#include <bits/stdc++.h>
using namespace std;
int i, j, p, d, n, m, total, k, ok, a, b, c, op, maxi, rasp, m1, m2, p1, p2,
    rez, modu = 1000000007, mini, mij, ls, ld;
int v[200001], poz[1000], cost[100005], ul;
vector<pair<int, int> > afis;
char ch;
string s;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  if (n % 1234567 == 0) {
    cout << "YES";
    return 0;
  }
  for (i = 1; n >= 0; n -= 1234567) {
    if (n % 123456 == 0) {
      cout << "YES";
      return 0;
    }
    a = n;
    while (a > 0) {
      if (a % 1234 == 0) {
        cout << "YES";
        return 0;
      }
      a -= 123456;
    }
  }
  cout << "NO";
  return 0;
}
