#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long a = 0, b = 0, c = 0;
  int flag = 0;
  long long i = 0;
  for (i = 0; i <= n; i += 1234567) {
    for (long long j = 0; j <= n - i; j += 123456) {
      if ((n - i - j) % 1234 == 0) flag = 1;
    }
  }
  if (flag == 1) {
    cout << "YES"
         << "\n";
  } else
    cout << "NO"
         << "\n";
  return 0;
}
