Submission #19407

#TimeUsernameProblemLanguageResultExecution timeMemory
19407QwazΣ (kriii4_P2)C++14
0 / 100
0 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 += b * modpow(a, MOD-2) % MOD; } printf("%lld\n", res); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...