#include using namespace std; int main() { int n; unsigned long long int c, d, an = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> c >> d; if (c % 2 == 0) { an += ((c / 2) * d) % 1000000007; } else { an += ((c / 2 + 1) * d) % 1000000007; } } cout << an << endl; }