Kshitij has recently started solving problems on codechef. As he is real problem solving enthusiast, he wants continuous growth in number of problems solved per day.
He started with $a$  problems on first day. 
He solves $d$ problems more than previous day. But after every $k$ days , he increases $d$ by
$inc$ .
Can you guess how many questions he will solve on $nth $ day ?

-----Input:-----
- First line  contains $T$, number of testcases. Then the testcases follow. 
- Each testcase contains of a single line of input,five integers $a, d, k, n, inc$. 

-----Output:-----
For each testcase, output in a single line number of questions solved on $nth$ day.

-----Constraints-----
- $1 \leq T \leq 15$
- $1 \leq a \leq 99$
- $1 \leq d \leq 100$
- $1 \leq n \leq 10000$
- $1 \leq k \leq n$
- $0 \leq inc \leq 99$

-----Sample Input:-----
1
1 4 3 8 2

-----Sample Output:-----
43

-----EXPLANATION:-----
The number of questions solved in first 8 days is :
$1$ $5$ $9$ $15$ $21$ $27$ $35$ $43$ .
On first day he solved 1 problem . Here $d$ is  4 for first 3 days.
Then after 3 days $d$ increases by 2 (that is 6).

```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 = "import sys,math,collections\r\nfrom collections import defaultdict\r\n\r\n#from itertools import permutations,combinations\r\n    \r\ndef file():\r\n    sys.stdin = open('input.py', 'r')\r\n    sys.stdout = open('output.py', 'w') \r\ndef get_array():\r\n    l=list(map(int, input().split()))\r\n    return l\r\ndef get_ints():   \r\n    return map(int, input().split())\r\n    #return a,b\r\ndef get_3_ints():   \r\n    a,b,c=map(int, input().split())\r\n    return a,b,c    \r\ndef sod(n):\r\n    n,c=str(n),0\r\n    for i in n: \r\n        c+=int(i)\r\n    return c    \r\ndef isPrime(n):\r\n    if (n <= 1):\r\n        return False\r\n    if (n <= 3):\r\n        return True\r\n    if (n % 2 == 0 or n % 3 == 0):\r\n        return False\r\n    i = 5\r\n    while(i * i <= n):\r\n        if (n % i == 0 or n % (i + 2) == 0):\r\n            return False\r\n        i = i + 6\r\n  \r\n    return True\r\ndef getFloor(A, x):\r\n\r\n    (left, right) = (0, len(A) - 1)\r\n\r\n    floor = -1\r\n    while left <= right:\r\n        mid = (left + right) // 2\r\n        if A[mid] == x:\r\n            return A[mid]\r\n        elif x < A[mid]:\r\n            right = mid - 1\r\n        else:\r\n            floor = A[mid]\r\n            left = mid + 1\r\n            \r\n    return floor\r\ndef chk(aa,bb):\r\n\tf=0\r\n\tfor i in aa:\r\n\t\tfor j in bb:\r\n\t\t\tif(j[0]>=i[0] and j[1]<=i[1]):\r\n\t\t\t\tf+=1\r\n\t\t\telif(j[0]<=i[0] and j[1]>=i[1]):\t\r\n\t\t\t\tf+=1\r\n\t\t\telif(i[0]==j[1] or i[1]==j[0]):\r\n\t\t\t\tf+=1\r\n\t\t\telse:\r\n\t\t\t\tcontinue\r\n\treturn f\t\t\t\r\n\r\n#file()\r\ndef main():\r\n\tfor tt in range(int(input())):\r\n\t\ta,d,k,n,inc=get_ints()\r\n\t\tj=1\r\n\t\tfor i in range(n-1):\r\n\t\t\tif(j==k):\r\n\t\t\t\td+=inc\r\n\t\t\t\tj=1\r\n\t\t\telse:\r\n\t\t\t\tj+=1\r\n\t\t\ta=a+d\t\r\n\t\tprint(a)\t\t\r\n\r\n\r\n\r\n\r\n\t\t\t\t\r\n\r\n\r\n\r\n\r\n\r\n\t\t\r\n\r\n\r\n\t\r\n\r\n\r\n\r\n\r\n\r\n        \r\n            \r\n        \r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n    \r\n\r\n    \r\n    \r\n\r\n        \r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n        \r\n        \r\n\r\n        \r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n                \r\n\r\n            \r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n            \r\n            \r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n        \r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\ndef __starting_point():\r\n    main()\n__starting_point()"
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 15551