Juan's birthday is coming soon, and Luis wants to give him a special present. Juan is a Number Theory enthusiast, so Luis thinks the best present would be an anti-prime-power-quotient set of numbers (APPQ set from now on). An APPQ set is defined as a set $$$S$$$ such that, for any $$$x,y \in S$$$ where $$$x \lt y$$$, either $$$x$$$ is not a divisor of $$$y$$$, or the quotient $$$\frac{y}{x}$$$ has more than one distinct prime factor.
Luis has a number generator machine. The power of the prime factors of the numbers that his machine can generate is limited by an array $$$A=[a_1, a_2, \dots a_n]$$$ of size $$$n$$$. More formally, the machine can generate only numbers of the form:
$$$$$$ \prod_{i=1}^{n} p_i^{e_i} $$$$$$
where $$$p_i$$$ is the $$$i$$$-th smallest prime number and $$$e_i$$$ satisfies $$$0 \leq e_i \leq a_i$$$.
Luis aims to craft the best APPQ set $$$S$$$ utilizing his number generator machine. However, he's aware that Juan has discerning tastes when it comes to numbers. Juan assigns a score to each number based on the total count of its prime factors, counting repetitions. For a number $$$x=\prod_{i=1}^{k} p_i^{e_i}$$$, its score is defined as
$$$$$$ 2024!^{2024! \cdot \sum_{i=1}^{k} e_i} $$$$$$
The score of a set is the sum of the scores of each of its elements.
Help Luis find the APPQ set with the greatest score, and print how many elements the best APPQ set has and the sum of its elements. Since the answer may be huge, print it modulo $$$998244353$$$.
The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 500$$$).
The second line contains $$$n$$$ integers $$$a_1, a_2, \dots a_n$$$ ($$$0 \leq a_i \leq 500$$$).
Print two integers $$$-$$$ the number of elements in the best APPQ set and the sum of its elements. Since the answer may be huge, print it modulo $$$998244353$$$. If there are multiple answers, print any of them.
11
1 2
21 1
2 7
32 0 2
3 111
| Название |
|---|


