Submission #19411

#TimeUsernameProblemLanguageResultExecution timeMemory
19411QwazΣ (kriii4_P2)C++14
100 / 100
7 ms1084 KiB
#include <cstdio> typedef long long ll; const int MOD = 1000000007; ll modpow(ll a, ll x) { ll ret = 1; a = a % MOD; while (x) { if (x & 1) ret = ret * a % MOD; a = a * a % MOD; x >>= 1; } return ret; } int main() { int n; scanf("%d", &n); ll res = 0; for (int i = 0; i < n; i++) { int a, b; scanf("%d%d", &a, &b); res = (res + b * modpow(a, MOD-2)) % MOD; } printf("%lld\n", res); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...