Numbers

No attempts yetTime limit1sMemory limit1024 MB

Problem

Jurgita studies digits and numbers. She picked three distinct digits from 11 to 99, formed every possible three-digit number using them, and sorted these numbers in increasing order. Because the three digits are all different, there are exactly 66 distinct three-digit numbers.

You are given a three-digit number xx built from the chosen digits. Determine the position of xx in the sequence sorted in increasing order.

Input

The first line contains the three digits aa, bb, cc chosen by Jurgita, separated by spaces. The second line contains the number xx formed from the chosen digits.

Output

Print the position of the given number xx in the sequence.

Constraints

  • 1a,b,c91 \le a, b, c \le 9; aba \ne b; aca \ne c; bcb \ne c