#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
double E = 2.71828182846;
double PI = 3.1415926535897932384626433832795;
double EPS = 1e-9;
const int ROOT = 444;
const int MAXN = 300100;
const int ROOTN = 555;
int n;
int gcd(int a, int b) {
  while (b) {
    a %= b;
    swap(a, b);
  }
  return a;
}
void solve() {
  cin >> n;
  for (int i = 0; i <= n; i += 1234567) {
    for (int j = i; j <= n; j += 123456) {
      if ((n - j) % 1234 == 0) {
        cout << "YES";
        return;
      }
    }
  }
  cout << "NO";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  srand(1313);
  solve();
  return 0;
}
