#include using namespace std; int main() { int n; int md = 1000000007; cin >> n; unsigned long long c, d, ans = 0; for (int i = 0; i < n; i++) { cin >> c >> d; ans += static_cast(ceil(c / 2.0) * d) % md; } cout << setprecision(20) << ans % md << endl; return 0; }