Algorithms

Softeer: H-클린알파

Roien 2021. 12. 22.
반응형
import sys


P, N = map(int, sys.stdin.readline().split())
virus = list(map(int, sys.stdin.readline().split()))
mul = P

if len(virus) >= 2:
    for i in range(len(virus) - 2, -1, -1):
        virus[i] = (virus[i]*mul)%1000000007
        mul = (mul*P)%1000000007

print(sum(virus)%1000000007)

 

 

반응형

댓글