Submission #20154

#TimeUsernameProblemLanguageResultExecution timeMemory
20154veckalΣ (kriii4_P2)C11
100 / 100
8 ms1084 KiB
#include <stdio.h> #define MOD 1000000007 typedef long long ll; ll pow(ll base, ll exp) { if (exp == 1) return base; ll ret = pow(base, exp>>1); ret = (ret * ret) % MOD; if (exp&1) ret = (ret * base) % MOD; return ret; } ll inv(ll a) { return pow(a, MOD-2); } int m, n, s, i; int ans; int main() { scanf("%d", &m); for (i=0; i<m; ++i) { scanf("%d%d", &n, &s); ans = (ans + (inv(n) * s) % MOD) % MOD; } printf("%d\n", ans); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...