Let Max be the maximum possible mean of a multiset of values obtained from an array.

Let Min be the minimum possible mean of a multiset of values obtained from the same array. Note that in a multiset values may repeat.The task is to find the **number of multisets** with mean as Max and the number of multisets with mean as Min. The answer may be too large so output the number of multisets modulo 10^{9}+7.

**Input: **

The first line of input contains a single integer **T** denoting the number of test cases. Then **T** test cases follow. The first line of each test case contains a positive integer **N** which denotes the size of the array. In the next line are **N** space separated positive integers which are the value of array **A**.

**Output:**

Corresponding to each test case, in a new line, print two space separated integers which denote the number of multisets with mean as Max and the number of multisets with mean as Min. The output should be done modulo 10^{9}+7.

**Constraints:**

1 ≤ T ≤ 100

1 ≤ N ≤ 1000

1≤A[i] ≤1000

**Example:**

**Input:**

1

5

3 1 2 3 4

**Output:**

1 1

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.

saiujwal13083 | 489 |

sudeep235poojary | 302 |

VithalNakod | 272 |

AshutoshPal1 | 254 |

go__karuna | 253 |

Soseph_Jtalin | 792 |

AshutoshPal1 | 722 |

architjindal__ | 648 |

go__karuna | 577 |

ArbazGrewal | 527 |

blackshadows | 5362 |

Ibrahim Nash | 5242 |

akhayrutdinov | 5111 |

mb1973 | 4931 |

Quandray | 4598 |

Login to report an issue on this page.