#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  int t, r;
  int temp = 0;
  for (int i = 0; i <= n; i += 1234567) {
    t = n - i;
    for (int j = 0; j <= t; j += 123456) {
      r = t - j;
      if (r % 1234 == 0) {
        temp = 1;
        break;
      }
    }
    if (temp == 1) break;
  }
  if (temp == 1)
    printf("YES\n");
  else
    printf("NO\n");
  return 0;
}
