#include <bits/stdc++.h>
using namespace std;
int GCDFast(int a, int b) {
  while (b) b ^= a ^= b ^= a %= b;
  return a;
}
int dx[8] = {-1, 0, 1, 0, -1, 1, 1, -1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T>
inline T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int GCD(int b, int a) {
  if (a == 0) return b;
  return GCD(a, b % a);
}
long long getLcm(long long a, long long b) {
  long long c = a / gcd(a, b);
  return b * c;
}
bool mysort(int a, int b) {
  if (a > b) return true;
  return false;
}
long long data[100005], length;
void binary(int index, string str) {
  if (length == index) {
    cout << str << "\n";
    for (int i = 0; i < length; i++) {
      if (str[i] == '1') cout << data[i];
    }
    cout << "\n";
    return;
  }
  binary(index + 1, str + '0');
  binary(index + 1, str + '1');
}
int main() {
  long long n, i, j, k, result = 0, temp, m;
  long long x, y, z, sum, test_case, ans, len;
  string name;
  bool check;
  while (cin >> n) {
    check = false;
    for (i = 0; i <= n && !check; i += 1234567) {
      for (j = 0; j <= n; j += 123456) {
        x = n - i - j;
        if (x >= 0 && x % 1234 == 0)
          check = true;
        else if (x < 0)
          break;
      }
    }
    if (check)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
