#include <bits/stdc++.h>
using namespace std;
inline int readInt() {
  int sign = 1, x = 0, c = getc(stdin);
  while (c <= 32) {
    c = getc(stdin);
  }
  if (c == '-') {
    sign = -1;
    c = getc(stdin);
  }
  while ('0' <= c && c <= '9' && c != EOF) {
    x = (x << 1) + (x << 3) + c - '0';
    c = getc(stdin);
  }
  return x * sign;
}
inline void writeLong(long long x) {
  if (x < 0) {
    putc('-', stdout);
    x = -x;
  }
  char s[40];
  int n = 0;
  while (x || !n) {
    s[n++] = '0' + x % 10;
    x /= 10;
  }
  while (n--) {
    putc(s[n], stdout);
  }
}
unsigned long long n;
int main() {
  bool found = false;
  n = readInt();
  for (int i = 0; i * 1234567 <= n; ++i)
    for (int j = 0; (j * 123456 + i * 1234567) <= n; ++j) {
      unsigned long long x = n - (j * 123456 + i * 1234567);
      if (!(x % 1234)) {
        found = 1;
        break;
      }
    }
  puts(found ? "YES" : "NO");
  return 0;
}

### Prompt

Construct a CPP code solution to the problem outlined:

Kolya is developing an economy simulator game. His most favourite part of the development process is in-game testing. Once he was entertained by the testing so much, that he found out his game-coin score become equal to 0.

Kolya remembers that at the beginning of the game his game-coin score was equal to n and that he have bought only some houses (for 1 234 567 game-coins each), cars (for 123 456 game-coins each) and computers (for 1 234 game-coins each).

Kolya is now interested, whether he could have spent all of his initial n game-coins buying only houses, cars and computers or there is a bug in the game. Formally, is there a triple of non-negative integers a, b and c such that a × 1 234 567 + b × 123 456 + c × 1 234 = n?

Please help Kolya answer this question.

Input

The first line of the input contains a single integer n (1 ≤ n ≤ 109) — Kolya's initial game-coin score.

Output

Print "YES" (without quotes) if it's possible that Kolya spent all of his initial n coins buying only houses, cars and computers. Otherwise print "NO" (without quotes).

Examples

Input

1359257


Output

YES

Input

17851817


Output

NO

Note

In the first sample, one of the possible solutions is to buy one house, one car and one computer, spending 1 234 567 + 123 456 + 1234 = 1 359 257 game-coins in total.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
inline int readInt() {
  int sign = 1, x = 0, c = getc(stdin);
  while (c <= 32) {
    c = getc(stdin);
  }
  if (c == '-') {
    sign = -1;
    c = getc(stdin);
  }
  while ('0' <= c && c <= '9' && c != EOF) {
    x = (x << 1) + (x << 3) + c - '0';
    c = getc(stdin);
  }
  return x * sign;
}
inline void writeLong(long long x) {
  if (x < 0) {
    putc('-', stdout);
    x = -x;
  }
  char s[40];
  int n = 0;
  while (x || !n) {
    s[n++] = '0' + x % 10;
    x /= 10;
  }
  while (n--) {
    putc(s[n], stdout);
  }
}
unsigned long long n;
int main() {
  bool found = false;
  n = readInt();
  for (int i = 0; i * 1234567 <= n; ++i)
    for (int j = 0; (j * 123456 + i * 1234567) <= n; ++j) {
      unsigned long long x = n - (j * 123456 + i * 1234567);
      if (!(x % 1234)) {
        found = 1;
        break;
      }
    }
  puts(found ? "YES" : "NO");
  return 0;
}

```