#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, ans = 0, temp;
  int a = 0, b = 0;
  cin >> n;
  while (1) {
    temp = (n - a * 1234567 - b * 123456);
    if (temp % 1234 == 0 && temp >= 0) {
      ans = 1;
      goto here;
    }
    if (temp < 0 && b == 0) {
      ans = 0;
      goto here;
    }
    if (temp < 0) {
      a++;
      b = 0;
    } else
      b++;
  }
here:
  if (ans)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
