Universal Cup Judging System

Universal Cup

시간 제한: 2.0 s 메모리 제한: 1024 MB 총점: 100 해킹 가능 ✓
통계

You are given an integer $N$ represented in decimal.

Consider all integers that can be formed by rearranging the digits of $N$ such that the resulting number has no leading zeros.

Find the number of such integers that are divisible by $11$, modulo $2147483647$ ($= 2^{31} - 1$), which is prime.

Note that the integers formed by rearranging the digits of $N$ include $N$ itself.

Input

The input is given in the following format:

$$N$$

  • All input values are integers.
  • $1 \le N < 10^{2 \times 10^6}$
  • $N$ is given in decimal without leading zeros.

Output

Print the answer on a single line.

Examples

Input 1

1001

Output 1

2

Input 2

31415926535

Output 2

144000

Note

In the first example, $1100$ and $1001$ satisfy the condition.

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
#1408EditorialOpen题解jianglyView

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.