#include using namespace std; typedef long long ll; const int MOD7 = ( int ) 1e9 + 7; signed main(){ int N; cin >> N; int ans = 0; for( int i = 0; i < N; ++i ){ ll C, D; cin >> C >> D; // C %= MOD7, D %= MOD7; ( ans += 1LL * ( C + 1 ) / 2 % MOD7 * ( D % MOD7 ) % MOD7 ) %= MOD7; } cout << ans << endl; return 0; }