#include #define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false)) #define precise(i) fixed << setprecision(i) #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; const int MOD = 1000000007; int main() { fastIO; int n; cin >> n; long long cnt = 0; for (int i = 0; i < n; i++) { long long c, d; cin >> c >> d; cnt = ((cnt % MOD) + ((c + 1) / 2) % MOD * (d % MOD)) % MOD; } cout << cnt << endl; return 0; }