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