#K11556. Product Except Self Sequence

    ID: 23494 Type: Default 1000ms 256MiB

Product Except Self Sequence

Product Except Self Sequence

Given a list of n integers, your task is to produce a new sequence c of length n such that each element c[i] is the product of all the elements of the input sequence except the one at index i. Formally, for each index i, compute:

\( c_i = \prod_{\substack{0 \leq j < n \\ j \neq i}} b_j \)

If the input contains only one element, output 1 by definition.

inputFormat

The first line of input contains an integer n, the number of elements. The second line contains n space-separated integers.

outputFormat

Output a single line with n space-separated integers representing the resulting sequence.

## sample
4
1 2 3 4
24 12 8 6

</p>