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