Ramp Number#8177

Ramp Number

1 second
128 megabytes
Medium

A Ramp Number is a number whose digits only rise or stay the same; they never fall.

Given a positive integer , if it is a ramp number, print the number of ramp numbers less than it. If it is not a ramp number, print .

Input

Starts with a single line giving the number of test cases. Each test case will be a single positive integer on a single line, with up to digits. The result will always fit into a -bit long.

Output

For each test case print if the input is not a ramp number. Print the number of ramp numbers less than the input value if the input value is a ramp number.

Examples

Example 1

Loading
Loading