Submission #19407

# Submission time Handle Problem Language Result Execution time Memory
19407 2016-02-24T11:26:42 Z Qwaz Σ (kriii4_P2) C++14
0 / 100
0 ms 1084 KB
#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 time Memory Grader output
1 Incorrect 0 ms 1084 KB Output isn't correct
2 Halted 0 ms 0 KB -