P13554 [CodeChef] tic02
NOI
题目描述

Guru S has turned miserly after the rise in petrol prices and wants to save as much petrol. For this he decides to calculate the total distance he has to travel to go to a place from a given distance T between each city. He also wants to see what distances he will travel in the reverse journey.

For N distances given between his home and the place he wants to go calculate the total distance he would have to travel. Also calculate the reverse of the distances he will travel.

Input
Each test case is formed as follows :

The first line contains a positive integer N, the number of distances such that 1 ≤ N ≤ 100

The next line contains N values each separated by a space, each value T such that 0 ≤ T ≤ 10^6

Output
For each case, out the reverse of the distances and the sum of the distances.

Example

Input:

9
1 2 3 4 5 6 7 8 9

Output:

9 8 7 6 5 4 3 2 1
45

输入格式

见题面

输出格式

见题面

样例输入
9 1 2 3 4 5 6 7 8 9
样例输出
9 8 7 6 5 4 3 2 1 45