#define _USE_MATH_DEFINES #include #define FOR(i,a,b) for(int i = (a); i < (b); ++i) #define REP(i,n) FOR(i,0,n) #define SZ(n) (int)(n).size() #define ALL(n) (n).begin(), (n).end() #define MOD 1000000007 using namespace std; typedef long long LL; typedef vector VI; int main() { int n; cin >> n; LL ans = 0; REP(i, n) { LL c, d; cin >> c >> d; if (c % 2 == 0) ans += (c / 2) * d; else ans += (c / 2 + 1) * d; } cout << ans % MOD << endl; return 0; }