#include <bits/stdc++.h>
using namespace std;
const long long int A = 1234567;
const long long int B = 123456;
const long long int C = 1234;
string yes = "YES";
string no = "NO";
int main() {
  long long int n;
  cin >> n;
  if (!(n % A) || !(n % B) || !(n % C)) {
    cout << yes;
    return 0;
  }
  for (long long int i = 0; i * A < n; i++) {
    for (long long int j = 0; j * B < n; j++) {
      long long int rem = n - i * A - j * B;
      if (rem < 0) {
        break;
      }
      if (!(rem % C)) {
        cout << yes;
        return 0;
      }
    }
  }
  cout << no;
}
