Professional Documents
Culture Documents
Problem - C - Codeforces
Enter | Register
Sponsored by
HOME
PROBLEMS
CONTESTS
SUBMIT
MY SUBMISSIONS
STATUS
HACKS
ROOM
STANDINGS
HELP
Se arch by tag
CUSTOM TEST
C. Prime Number
Finished
Practice?
Want to solve the contest problems after the
official contest ends? Just register for
practice and you will be able to submit
solutions.
on a
piece of paper. After Simon led all fractions to a common denominator and summed them up,
he got a fraction: , where number t equals xa 1+a 2+...+a n. Now Simon wants to reduce the
resulting fraction.
Help him, find the greatest common divisor of numbers s and t. As GCD can be rather large,
9
print it as a remainder after dividing it by number 1000000007 (10 +7).
Input
The first line contains two positive integers n and
the array and the prime number.
ACM-ICPC WF-2013
Problem tags
math
No tag edit access
Contest materials
Announcement
Output
Print a single number the answer to the problem modulo
1000000007 (109+7).
Sample test(s)
input
22
22
output
8
input
33
123
output
27
input
22
29 29
output
73741817
input
45
0000
file:///F:/INFORMTICA/ACM/Codeforces/Problemitas/Prime number.html
1/2
14/11/13
Problem - C - Codeforces
output
1
Note
In the first sample
In the second sample,
as 351=1327, 729=2727.
In the third sample the answer to the problem is 1073741824
73741817.
In the fourth sample
mod 1000000007=
file:///F:/INFORMTICA/ACM/Codeforces/Problemitas/Prime number.html
2/2