cho.sh
NotesCho Mini
Loading...

Number Cards

Time limit

1s

Memory limit

128 MB

Problem

There are plenty of cards labeled with the numbers from 1 to 34. Some of these cards were placed in a row, and their labels were written down from left to right as one continuous string. For example, if the cards are arranged as shown below, the resulting string is 27123.

Later, given only the written string, you try to reconstruct the original row of cards. There may be several possible arrangements. The string 27123 can be made in six different ways, as shown below.

Given the digit string formed by concatenating card labels, write a program that counts how many card arrangements can produce it.

Input

The first line contains the digit string formed by concatenating card labels. The string consists only of digits and has length at most 40.

Output

Print the number of possible card arrangements on the first line.