# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
20154 | veckal | Σ (kriii4_P2) | C11 | 8 ms | 1084 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |