#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a = 1234567, b = 123456, c = 1234;
  int op1 = n / a, op2 = n / b, op3 = n / c;
  bool f = false;
  for (int i = 0; i <= op1; i++) {
    for (int j = 0; j <= op2; j++) {
      if (a * i + b * j == n) {
        cout << "YES";
        return 0;
      } else if (a * i + b * j > n) {
        break;
      }
      if ((n - a * i - b * j) % c == 0) {
        cout << "YES";
        return 0;
      }
    }
  }
  cout << "NO";
  return 0;
}
