#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-15;
const double pi = acos(-1.0);
const int inf = (int)1e9 + 7;
const int mod = (int)1e9 + 7;
const int N = 1e5 + 5;
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  long long n;
  long long x = 1234567;
  long long y = 123456;
  long long z = 1234;
  cin >> n;
  for (long long a = 0; a <= 810; a++) {
    for (long long b = 0; b <= 8100; b++) {
      long long h = a * x + b * y;
      if (h > n) {
        break;
      }
      h = n - h;
      if (h % z == 0) {
        cout << "YES" << '\n';
        return 0;
      }
    }
  }
  cout << "NO" << '\n';
  return 0;
}
