Problem 05C. Product of Array Except Self ≡

Author:Pavel Mesenev   Time limit:2 sec
Input file:Standard input   Memory limit:256 Mb
Output file:Standard output  

Statement

You are given an array a0, a1, …, an − 1 of integers, which may include zero and negative values. For every index i, output the product of every element except ai (the product of an empty set of factors, when n = 1, is 1).

You may not use division.

Input format

The first line contains one integer n. The second line contains n space-separated integers a0… an − 1.

Output format

Print n space-separated integers: the answer for each index, in order.

Constraints

1 ≤ n ≤ 800

 − 50 ≤ ai ≤ 50

Sample tests

No. Standard input Standard output
1
4
1 2 3 4
24 12 8 6
2
5
-1 1 0 -3 3
0 0 9 0 0
3
1
7
1

0.034s 0.009s 16