Submit | All submissions | Best solutions | Back to list |
CERI2018K - Sum of divisors |
The goal of the problem is to compute the sum of divisors for some integers .
Assume that number , where are prime numbers, and are positive integers.
Input
The first line of the input consist of a single integer number which determines the number of tests.
Each test is on two separate lines.
In each test,
- on the first line, there is two integer numbers , and .
- on the second line, there is integer numbers and , with a prime number.
Constraints
- ;
- ;
- ;
- , a prime number ;
- .
Output
For each test case, you are given a prime factorization of , you'll have to print the sum of divisors of , modulo .
Example
Input: 3 0 1000 17,1 2 100 2,1 5,1 7,2 1 1000 3,1 1000000007,1 Output: 18 26 32
Explanation
For the first test case, , whose sum of divisors is .
For the second test case, , whose sum of divisors is .
Added by: | Francky |
Date: | 2018-05-08 |
Time limit: | 1s-10s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |