제출 #19527

#제출 시각아이디문제언어결과실행 시간메모리
19527NamnamseoΣ (kriii4_P2)C++14
100 / 100
25 ms1716 KiB
#include <iostream>
using namespace std;
typedef long long ll;
int M=int(1e9)+7;
ll pow(ll a,ll b){
    if(b==0) return 1;
    ll ret=pow(a,b/2);
    ret=(ret*ret)%M;
    if(b&1) ret=(ret*a)%M;
    return ret;
}
int main()
{
    ll ret=0, tmp;
    int n;
    cin>>n;
    int a,b;
    for(;n--;){
        cin>>a>>b;
        tmp=b*pow(a,M-2)%M;
        ret=(ret+tmp)%M;
    }
    cout<<ret;
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...