#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define debug(x) cout<<#x<<": "< vi; long long mod2(long long n){ return n % 1000000007; } void solve(){ #ifdef _WIN32 istream &cin = ifstream("input.txt"); #endif long long n, ans = 0; cin >> n; rep(i, n){ long long t1, t2; cin >> t1 >> t2; t1 = ceil((double)t1 / 2); cout << t1 << endl; ans += mod2(mod2(t1) * mod2(t2)); ans = mod2(ans); } cout << ans << endl; } int main(){ cin.tie(0); ios::sync_with_stdio(false); solve(); system("PAUSE"); return 0; }