# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
106320 | 2019-04-17T21:13:42 Z | xiaowuc1 | Σ (kriii4_P2) | C++14 | 0 ms | 0 KB |
#include <algorithm> #include <cassert> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <vector> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, int> plli; typedef vector<vector<ll>> matrix; ll modpow(ll b, ll e, ll m) { ll r = 1; b %= m; while(e) { if(e%2) { r*=b; r%=m; } b*=b; b%=m; e/=2; } return r; } void solve() { int n; cin >> n; ll ret = 0; while(n--) { int a, b; cin >> a >> b; ret += b * modpow(a, 1e9 + 5, 1e9+7); ret %= 1e9+7; } cout << ret << endl; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); /* int t; cin >> t; for(int i = 1; i <= t; i++) { cout << "Case #" << i << ": "; solve(); } */ solve(); }