The $String$ Family gave birth to a new $Tripartite$ $trio$ $sisters$ and named them $Hema$, $Rekha$ and $Sushma$. Hema and Rekha are very fond of parties whereas Sushma hates them. One day Hema and Rekha asked their parents to buy them candies to distribute to people in their birthday party. (Remember Hema, Rekha and Sushma were born on the same day). But Sushma was uninterested in the party and only wanted candies for herself.
You will be given a list $P$ of possible number of candidates coming to the party. Were $P[i]$ denotes the count of people coming in the i th possibility. In each case every person should get maximum possible equal number of candies  such that after distributing the candies, there are always $R$ candies remaining for Sushma. You have to calculate the minimum number of candies required to buy so that, in any possible situation of the given array, each person coming to party gets equal number of candies (at least 1 and maximum possible out of total) and there are always $R$ candies remaining for Sushma.

-----Input:-----
- First line will contain $T$, number of testcases. Then the testcases follow. 
- First line of each test case contain  $N$, number of possible count of people coming to party
- Next line contain $N$ spaced integers denoting the count of people 
- Next line contain $R$ the number of candies always remaining after maximum equal distribution

-----Output:-----
For each testcase, output in a single line answer, the minimum number of candies required to buy.

-----Constraints-----
- $1 \leq T \leq 100$
- $1 \leq N \leq 10^4$
- $1 \leq P[i] \leq 41$
- $0 \leq R < min(P[i])$

-----Sample Input:-----
1
2
2 3
1

-----Sample Output:-----
7

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = '# cook your dish here\ndef gcd(a,b): \n    if a == 0: \n        return b \n    return gcd(b % a, a) \n  \ndef lcm(a,b): \n    return (a*b) // gcd(a,b) \n \nfor _ in range(int(input())) :\n    n = int(input())\n    arr = list(map(int , input().split()))\n    k = int(input())\n    if(n==1) :\n        print(arr[0]+k)\n    if(n==2) :\n        print(lcm(arr[0],arr[1])+k)\n    else :\n        l = lcm(arr[0],arr[1])\n        for i in range(2, len(arr)): \n            l = lcm(l, arr[i])\n        print(l+k)'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 13585