#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define REP(i,a,b) for(int i=a;i<(int)b;i++) #define rep(i,n) REP(i,0,n) #define all(c) (c).begin(), (c).end() #define zero(a) memset(a, 0, sizeof a) #define minus(a) memset(a, -1, sizeof a) #define minimize(a, x) a = std::min(a, x) #define maximize(a, x) a = std::max(a, x) typedef long long ll; int const inf = 1<<29; int const MOD = 1e9+7; int main() { int N; cin >> N; int ans = 0; rep(i, N) { ll c, d; cin >> c >> d; ans += (c + 1) / 2 * d % MOD; ans %= MOD; } cout << ans << endl; return 0; }