#P9836. 种树
种树
Background
Little Rf does not really like planting flowers, but he likes planting trees.
Problem Description
There are trees by the roadside. The height of each tree is a positive integer, denoted as .
Define the width of a tree as the number of positive divisors of its height. The distance these trees can cover is the product of their widths. You want to invite your friends to enjoy the shade, but you find that the distance these trees can cover is not large enough.
So you buy a total of units of magic fertilizer. You may fertilize multiple times. Each time, you can use units of fertilizer ( must be a positive divisor of the current amount of fertilizer), multiply the height of any one tree by , and at the same time your remaining fertilizer amount will be divided by . The tree chosen for each fertilization can be arbitrary, and the chosen trees do not need to be the same across operations.
You need to maximize the distance that these trees can cover, and output this maximum distance. Take the answer modulo .
Input Format
Read input from standard input.
The first line contains two positive integers and .
The second line contains positive integers .
Output Format
Write output to standard output.
Output one integer on a single line, representing the answer modulo .
3 60
8 243 250
2304
Hint
[Sample 1 Explanation]
- First fertilization: apply units of fertilizer to the first tree, making its height become , with units of fertilizer remaining.
- Second fertilization: apply units of fertilizer to the second tree, making its height become , with unit of fertilizer remaining.
- At this time, the widths of the three trees are respectively, and the distance they can cover is , which is the optimal solution.
[Sample 2]
See the attached files and .
[Sample 3]
See the attached files and .
[Constraints]
| Test Point ID | Points | |||
|---|---|---|---|---|
For of the testdata, it is guaranteed that , , and .
Translated by ChatGPT 5