#include #define rep(i, ss, ee) for (int i = ss; i < ee; ++i) using namespace std; using ull = unsigned long long; const ull MOD = 1e9 + 7; void solve() { ull N, c, d, ans = 0; cin >> N; rep(i, 0, N) { cin >> c >> d; ans = ((ans % MOD) + (((c + 1) / 2 % MOD) * (d % MOD)) % MOD) % MOD; } cout << ans << endl; } int main() { ios::sync_with_stdio(false); cin.tie(0); solve(); getchar(); }