Submission #19364

#TimeUsernameProblemLanguageResultExecution timeMemory
19364sys7961Σ (kriii4_P2)C++14
100 / 100
7 ms1084 KiB
#include<stdio.h> const long long M = 1000000007; long long pow(long long n, long long b) { if (b == 0) { return 1; } long long temp = pow(n, b / 2); if (b % 2 == 1) { return temp*temp%M*n%M; } return temp*temp%M; } int main() { int m; scanf("%d", &m); long long ans = 0; for (int i = 0; i < m; i++) { long long n, s; scanf("%lld%lld", &n, &s); ans += s*pow(n, M - 2); ans %= M; } printf("%lld", ans); }
#Verdict Execution timeMemoryGrader output
Fetching results...