Project Euler Problem 97 Statement
Solution
Python Source Code
s = 0
m = 10**12
for _ in range(int(input())):
a, b, c, d = map(int, input().split())
s += (a * pow(b, c, m) + d) % m
print("%012d" % (s % m))
Large Non-Mersenne prime
by {BetaProjects} | Project Euler & HackerRanks = 0
m = 10**12
for _ in range(int(input())):
a, b, c, d = map(int, input().split())
s += (a * pow(b, c, m) + d) % m
print("%012d" % (s % m))