#include using namespace std; #define LL long long #define REP(i, n) for(int i = 0; i < n; i++) const LL MOD = 1e9 + 7; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); LL n; cin >> n; LL ans = 0; REP(i, n) { LL c, d; cin >> c >> d; LL cc = ((c + 1) / 2) % MOD, dd = d % MOD; ans += (cc * dd) % MOD; } cout << (ans % MOD) << endl; return 0; }