#include <bits/stdc++.h>
using namespace std;
long long a, b, c;
long long x, y, z, n;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
int main() {
  cin >> n;
  a = 1234567;
  b = 123456;
  c = 1234;
  for (int i = 0; i * a <= n; i++) {
    for (int j = 0; i * a + j * b <= n; j++) {
      if ((n - i * a - j * b) % c == 0) {
        cout << "YES";
        return 0;
      }
    }
  }
  cout << "NO";
  return 0;
}
