Jurgita studies digits and numbers. She picked three distinct digits from 1 to 9, 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 6 distinct three-digit numbers.
You are given a three-digit number x built from the chosen digits. Determine the position of x in the sequence sorted in increasing order.
The first line contains the three digits a, b, c chosen by Jurgita, separated by spaces. The second line contains the number x formed from the chosen digits.
Print the position of the given number x in the sequence.