#include using namespace std; int main(){ int n; cin >> n; int total = 0; int c,d; for(int i = 0; i < n; i++){ cin >> c >> d; c--; total += c * d; } cout << total % 1000000000 + 7 << endl; return 0; }