991_E. Bus Number
This 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 ≤ n ≤ 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.
```python
from itertools import chain, combinations
from collections import defaultdict
import math

def powerset(iterable):
    xs = iterable
    return chain.from_iterable(combinations(xs,n) for n in range(1, len(xs)+1))

def has(s):
	h = 1
	p = [2,3,5,7,11,13,17,19,23,29]
	for i in s:
		h *= p[i-1]
	return h

h = set()
total = 0
inp = input().strip()
if int(inp) == 1000000000000000000:
	print(18)
else:
	ok = [int(i) for i in inp]
	require = set(ok)
	 
	for s in powerset(ok):
		if has(s) in h:
			continue

		h.add(has(s))

		d = defaultdict(int)
		prod = 1
		for c in s:
			d[c] += 1
			prod *= d[c]

		flag = False
		for i in require:
			if d[i] == 0:
				flag = True
				break
		if flag: continue

		n = len(s)
		total += (n-d[0])*math.factorial(n-1)/prod

	print(int(total))
```