This year at Spirit of Math Schools, you have been assigned to find the number of unique numbers between and (inclusive) you can create using a list of digits. You may add or concatenate digits. Their order must be maintained, and every digit must be used. Output the number of unique values you can create between and .
Subtask 1 [10%]
All of the digits are the same.
Subtask 2 [90%]
No additional constraints.
The first line contains two integers, and .
The next line contains a string of digits (numbers between and ).
Output a single line containing an integer, the number of unique values that can be created.
4 100 1996
Explanation for Sample
There are 8 possible combinations of operations:
Only two of these are between and ( and ).