Submission #19485

#TimeUsernameProblemLanguageResultExecution timeMemory
19485zych1751Σ (kriii4_P2)C++98
100 / 100
7 ms1084 KiB
#include<cstdio> const int INF = 1e9+7; long long mod(long long a) // a^(x-2) { int mul = 1e9+5; long long result = 1; a %= INF; while(mul) { if(mul & 1) result = (result * a) % INF; a = (a*a) % INF; mul /= 2; } return result; } int main() { int m; long long n, s; long long result = 0; scanf("%d", &m); for(int i = 0; i < m; i++) { scanf("%lld %lld", &n, &s); result += s * mod(n); result %= INF; } printf("%lld", result); }
#Verdict Execution timeMemoryGrader output
Fetching results...