#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; const constexpr int INF = 1e9; //typedef std::pair P; #define FOR(i, a, n) for (ll i = (ll)a; i<(ll)n; ++i) #define REP(i, n) FOR(i, 0, n) typedef long long ll; typedef vector VI; const constexpr ll MOD = 1e9+7; vector > vp; struct Less { bool operator()(const pair& x, const pair& y) const { return x.first > y.first; } }; ll GCD(ll a, ll b){ if(b==0) return a; return GCD(b, a%b); } //グラフの隣接リスト VI g[200010]; //頂点の入次数を管理 int h[100010]; string s; int a[100010]; int b[100010]={INF}; int main(void) { int N; cin >> N; ll ans =0; REP(i, N){ ll C, D; cin >> C >> D; C = (C+1)/2%MOD; D=D%MOD; ans += (C*D)%MOD; ans = ans %MOD; } cout << ans << endl; }