#K95667. Product Except Self

    ID: 38915 Type: Default 1000ms 256MiB

Product Except Self

Product Except Self

Given an array of integers, compute an output array such that for each index i, the value is the product of all the array elements except the one at index i, taken modulo $$10^9+7$$.

For example, if the input array is [1, 2, 3, 4, 5], the output should be [120, 60, 40, 30, 24]. Note that if the array contains only one element, the output is [1].

inputFormat

The first line of input contains a single integer n (the number of elements). The second line contains n space-separated integers representing the array elements.

outputFormat

Output a single line with n space-separated integers where the i-th number is the product of all the array elements except the element at index i, computed modulo $$10^9+7$$.

## sample
5
1 2 3 4 5
120 60 40 30 24