We have a variable and kinds of operations that change the value of . Operation is represented as a pair of integers , and is the following operation:
if , it replaces the value of with ;
if , it replaces the value of with ;
if , it replaces the value of with .
Initialize with the value of and execute the following procedures in order:
Perform Operation , and then print the resulting value of .
Next, perform Operation in this order, and then print the value of .
Next, perform Operation in this order, and then print the value of .
Next, perform Operation in this order, and then print the value of .
Constraints
All values in input are integers.
Sample Input
310 33 25 112
Sample Output
9 15 12
The initial value of is .
Operation changes to . Next, Operation changes to , and then Operation changes it to . Next, Operation changes to , and then Operation changes it to , and then Operation changes it to .
There are balls arranged from left to right. The color of the -th ball from the left is Color , and an integer is written on it. Takahashi wants to rearrange the balls so that the integers written on the balls are non-decreasing from left to right. In other words, his objective is to reach a situation where, for every , the number written on the -th ball from the left is greater than or equal to the number written on the -th ball from the left. For this, Takahashi can repeat the following operation any number of times (possibly zero):
Choose an integer such that . If the colors of the -th and -th balls from the left are different, pay a cost of . (No cost is incurred if the colors are the same). Swap the -th and -th balls from the left.
Find the minimum total cost Takahashi needs to pay to achieve his objective.