#C8206. Product Except Self

    ID: 52163 Type: Default 1000ms 256MiB

Product Except Self

Product Except Self

You are given an array of integers. Your task is to compute an output array where each element at index i is equal to the product of all the elements in the input array except the one at i. You must solve the problem without using the division operator.

More formally, given an array \(a = [a_0, a_1, \dots, a_{n-1}]\), construct an output array \(res\) such that:

[ res[i] = \prod_{\substack{0 \leq j < n \ j \neq i}} a_j, \quad \text{for } 0 \leq i < n. ]

It is guaranteed that the multiplication of numbers fits within the bounds of a 64-bit integer in all test cases.

inputFormat

The first line of input contains a single integer n indicating the size of the array.

The second line contains n space-separated integers representing the array elements.

outputFormat

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

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