#include using namespace std; typedef long long ll; const ll MOD = 1e9+7; int main() { ll n; cin >> n; ll ans = 0; while (n--) { ll c, d; cin >> c >> d; ans += (c + 1) / 2 % MOD * (d % MOD) % MOD; ans %= MOD; } cout << ans << endl; }