Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Chief Thief

By subeen · Limits 1s, 512 MB

A group of thieves steal only money. Every morning they deposit the money to their leader. The leader of the thieves recently bought a computer (or stole from somewhere?). He wants a program that he can use to track the money deposited by all members. Hence he asked a programmer to write a program for him, that can find the total amount deposited by all thieves.

The programmer wrote a simple program. As he didn't know for which thief the leader didn't want calculate the amount, he made his program flexible. It takes a list of numbers as input and outputs another list. In the output, the ii-th number is the summation of all the numbers except the ii-th number in the input. Hence, if the input numbers are 1,2,3,41, 2, 3, 4, output will be, 9,8,7,69, 8, 7, 6. But the chief thief (leader) didn't like the program, He asked the programmer, why don't you multiply all the numbers instead of adding? The programmer knows it doesn't make any sense, but he also doesn't want to loose the money he will get for his program, he is asking for your help to write it for you.

According to the formula of chief thief, if the input is 1,2,3,41, 2, 3, 4, output will be 24,12,8,624, 12, 8, 6.


Next line will have n integers, where maximum value of an integer will be 10510^5.


Output will consists of n integers separated by spaces. There shouldn’t be any space character after the last number.

It's guaranteed that each integer in the output will be less than 2312^{31}.


1 2 3 4
24 12 8 6