#include <bits/stdc++.h>
using namespace std;
bool f() {
  long long int n, a, b, c;
  cin >> n;
  a = 0;
  while (a * 1234567 <= n) {
    b = 0;
    while (b * 123456 <= n) {
      c = n - 1234567 * a - 123456 * b;
      if (c < 0) break;
      if (c % 1234 == 0) return true;
      b++;
    }
    a++;
  }
  return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  if (f())
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
