Minimum Product of k Integers
##### Submissions: 7194   Accuracy: 21.9%   Difficulty: Basic   Marks: 1

Given an array of N positive integers. You need to write a program to print the minimum product of k integers of the given array.

Examples:

Input : 198 76 544 123 154 675
k = 2
Output : 9348
We get minimum product after multiplying
76 and 123.

Input : 11 8 5 7 5 100
k = 4
Output : 1400

Note: Since output could be large, hence module 10^9+7 and then print answer.

Input:
First line of the input contains an integer T, denoting the number of test cases. Then T test case follows. First line of each test case contains an integer N, denoting the size of the array. Next line contains N space separated integers denoting the elements of the array. Last line of each test case contains the integer K.

Output:
For each test case print the required anwer in a new line.

Constraints:
1<=T<=103
1<=K<=N<=105

Example:
Input:

2
5
1 2 3 4 5
2
3
9 10 8
3
Output:
2
720

#### ** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Harshit Sidhwa
Author: harshitsidhwa

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.