#include #include #include using namespace std; typedef long long ll; #define rep(i,n) for(int i=0;i<(n);i++) const ll mod = 1e9 + 7; int main(void){ ll n; cin >> n; ll ans = 0; rep(i, n){ ll c, d; cin >> c >> d; if(c % 2 == 0){ ans += (c / 2) % mod * d % mod; }else{ ans += (c / 2 + 1) % mod * d % mod; } ans %= mod; printf("%lld\n", ans); } printf("%lld\n", ans); return 0; }