#K93572. Product Except Self

    ID: 38449 Type: Default 1000ms 256MiB

Product Except Self

Product Except Self

You are given an array of n integers. Your task is to compute a new array where each element at index i is the product of all numbers in the input array except the element at index i. In other words, for each valid index i, you need to calculate:

\( result[i] = \prod_{\substack{0 \leq j < n \\ j \neq i}} nums[j] \)

It is guaranteed that the product of all the elements (except possibly one) will fit in a 64-bit integer. Note that the input may include zeros and negative numbers, so take care of edge cases accordingly.

inputFormat

The first line of input contains an integer n denoting the number of elements in the array.
The second line contains n space-separated integers representing the elements of the array.

outputFormat

Output a single line containing n space-separated integers where the i-th integer is the product of all elements of the input array except the one at index i.

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

</p>