Finally, COVID-19 has been eradicated! To celebrate, you and your neighbours decide to meet up to have a massive party. You and your neighbours live along a street with houses numbered to . Each house is at a height of . The travel cost from house to house is defined as: or if .
To have a party at house , everyone must come to house . The total cost of having the party at house is the sum of the travel costs of each individual house travelling to house . However, not everyone on your street is willing to host such a massive party. More specifically, out of you and your neighbours, only people are willing to host it. To help determine the best house to have the party, you have compiled all the house numbers into a list that would be willing to host a party. For each house in , print out the cost of having a party at .
Input Specification
The first line will contain the positive integer , the number of houses on your street.
The second line will contain space-separated positive integers, , the height of the house.
The third line will contain the positive integer , the number of people willing to host the party.
The next lines will contain a positive integer .
Output Specification
For each house number , print out the corresponding cost of hosting a party at .
Constraints
For all subtasks:
Subtask 1 [10%]
Subtask 2 [20%]
Subtask 3 [70%]
No additional constraints.
Sample Input 1
4
1 2 5 1
2
2
4
Sample Output 1
11
19
Sample Input 2
8
1 3 2 5 999 0 6 6
5
6
5
4
3
2
Sample Output 2
8996
6998
6998
7004
7008
Comments