#include #include #include using namespace std; #define FOR(i, a, n) for (int i = a; i < n; i++) #define REP(i, n) for(int i = 0; i < n; i++) struct omt{omt(){ios::sync_with_stdio(false);cin.tie(0);}}star; int main(){ int n; long c, d; cin >> n; long long ans = 0; REP(i, n){ cin >> c >> d; ans += (((c + 1) / 2) * d) % 1000000007; } cout << ans << endl; return 0; }