#include using namespace std; const int MOD = 1e9 + 7; int main() { int N; cin >> N; int ret = 0; while(N--) { long A, B; cin >> A >> B; (ret += (A + 1) / 2 % MOD * (B % MOD) % MOD) %= MOD; } cout << ret << endl; }