Product Modulo 1e9+7
Print the product of all values modulo 1 000 000 007. Values may be negative; the printed result must be in [0, 109+6].
Input: the first line has an integer N; the second line has N integers separated by spaces.
Output: the product of the N values modulo 1 000 000 007 (non-negative).
Constraints:
- 1 ≤ N ≤ 2000
- −109 ≤ ai ≤ 109
Sample Tests
Input 1
3 2 3 4
Output 1
24
Input 2
2 -2 5
Output 2
999999997
Discussion (opens after you solve — no spoilers before)
No comments yet.