#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define FOR(I,A,B) for(int I = (A); I < (B); ++I) typedef long long ll; int main(){ int N; cin>>N; ll MOD = 1000000007; ll ans = 0; FOR(i,0,N){ ll C,D; cin>>C>>D; ans += (((C+1)/2)%MOD)*D; ans %= MOD; } cout << ans << endl; return 0; }