#include <bits/stdc++.h>
using namespace std;
const int INF = numeric_limits<int>::max();
const long long LLINF = numeric_limits<long long>::max();
const unsigned long long ULLINF = numeric_limits<unsigned long long>::max();
const double PI = acos(-1.0);
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long n;
  cin >> n;
  for (long long a = 0; a < 1000; a++) {
    for (long long b = 0; b < 10000; b++) {
      long long sum = 1234567ll * a + 123456ll * b;
      if (n >= sum && (n - sum) % 1234ll == 0) {
        cout << "YES";
        return 0;
      }
    }
  }
  cout << "NO";
  return 0;
}
