Submission #19057

#TimeUsernameProblemLanguageResultExecution timeMemory
19057kriiiΣ (kriii4_P2)C++14
100 / 100
0 ms1084 KiB
#include <stdio.h> const long long mod = 1000000007; long long fpow(long long a, long long p) { a = (a % mod + mod) % mod; p = (p % (mod - 1) + mod - 1) % (mod - 1); long long r = 1; while (p){ if (p & 1) r = r * a % mod; a = a * a % mod; p >>= 1; } return r; } int main() { long long ans = 0; int M; scanf ("%d",&M); while (M--){ long long N,S; scanf ("%lld %lld",&N,&S); ans = (ans + fpow(N,-1) * S) % mod; } printf ("%lld\n",ans); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...