E1. A Prime Flood (Easy Version)
time limit per test
3 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

This is the Easy version of the problem. The difference between the versions is that in this version, $$$1 \le n \le 3000$$$. You can hack only if you solved all versions of this problem.

Antigun and Lamus have flooded Madamant's house. She wants them to make the water levels equal while removing as little water as possible.

Formally, the initial water levels are given by an array $$$a = [a_1, a_2, \ldots, a_n]$$$. For each hypothetical cleanup, Antigun and Lamus select a non-empty subsequence$$$^{\text{∗}}$$$ $$$b$$$ of $$$a$$$. They may perform the following operation on $$$b$$$ any number of times, possibly zero:

  • choose a prime number $$$p$$$;
  • simultaneously decrease every element $$$b_i$$$ whose current value is divisible by $$$p$$$ by $$$1$$$. All other elements remain unchanged.

Let $$$f(b)$$$ be the maximum integer $$$x$$$ such that, after some sequence of operations, every element of $$$b$$$ is equal to $$$x$$$.

Find the sum of $$$f(b)$$$ over all non-empty subsequences $$$b$$$ of $$$a$$$, modulo $$$998\,244\,353$$$. Subsequences formed by different choices of indices are counted separately, even if their values are equal.

Each subsequence is considered independently, starting from its original values.

$$$^{\text{∗}}$$$A sequence $$$a$$$ is a subsequence of a sequence $$$b$$$ if $$$a$$$ can be obtained from $$$b$$$ by the deletion of several (possibly, zero or all) elements from arbitrary positions.

Input

Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 3000$$$). The description of the test cases follows.

The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 3000$$$) — the length of the array $$$a$$$.

The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le n$$$) — the elements of $$$a$$$.

It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$3000$$$.

Output

For each test case, print one integer — the sum of $$$f(b)$$$ over all non-empty subsequences $$$b$$$ of $$$a$$$, modulo $$$998\,244\,353$$$.

Example
Input
4
1
1
4
2 4 4 4
4
2 3 4 4
6
3 6 1 1 1 1
Output
1
37
34
72
Note

In the first test case, the only non-empty subsequence is $$$[1]$$$, and no operation is needed. Therefore, its contribution is $$$f([1]) = 1$$$.

In the second test case, the $$$2^3 - 1 = 7$$$ non-empty subsequences containing only occurrences of $$$4$$$ contribute $$$4 \cdot 7 = 28$$$. The subsequence $$$[2]$$$ contributes $$$2$$$. Each of the $$$7$$$ subsequences containing the value $$$2$$$ and at least one occurrence of $$$4$$$ has $$$f(b) = 1$$$. Hence, the answer is $$$28 + 2 + 7 = 37$$$.