Please subscribe to the official Codeforces channel in Telegram via the link: https://t.me/codeforces_official.
×

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ACM-ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

E. Bus Number

time limit per test

1 secondmemory limit per test

256 megabytesinput

standard inputoutput

standard outputThis night wasn't easy on Vasya. His favorite team lost, and he didn't find himself victorious either — although he played perfectly, his teammates let him down every time. He had to win at least one more time, but the losestreak only grew longer and longer... It's no wonder he didn't get any sleep this night at all.

In the morning, Vasya was waiting the bus to the university on the bus stop. Vasya's thoughts were hazy and so he couldn't remember the right bus' number quite right and got onto the bus with the number $$$n$$$.

In the bus, Vasya thought that he could get the order of the digits in the number of the bus wrong. Futhermore, he could "see" some digits several times, but the digits he saw were definitely in the real number of the bus. For example, if Vasya saw the number 2028, it could mean that the real bus number could be 2028, 8022, 2820 or just 820. However, numbers 80, 22208, 52 definitely couldn't be the number of the bus. Also, real bus number couldn't start with the digit 0, this meaning that, for example, number 082 couldn't be the real bus number too.

Given $$$n$$$, determine the total number of possible bus number variants.

Input

The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^{18}$$$) — the number of the bus that was seen by Vasya. It is guaranteed that this number does not start with $$$0$$$.

Output

Output a single integer — the amount of possible variants of the real bus number.

Examples

Input

97

Output

2

Input

2028

Output

13

Note

In the first sample, only variants $$$97$$$ and $$$79$$$ are possible.

In the second sample, the variants (in the increasing order) are the following: $$$208$$$, $$$280$$$, $$$802$$$, $$$820$$$, $$$2028$$$, $$$2082$$$, $$$2208$$$, $$$2280$$$, $$$2802$$$, $$$2820$$$, $$$8022$$$, $$$8202$$$, $$$8220$$$.

Codeforces (c) Copyright 2010-2018 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Dec/11/2018 00:08:04 (d2).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|