#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using ull = unsigned long long; using ll = long long; ull Mod = 1e9 + 7; int main() { ull n; cin >> n; ull sum = 0; for(int i =0; i < n; ++i) { ull c,d; cin >> c >> d; sum = (sum + ((c+1)/2)*d); sum %= Mod; } cout << sum << endl; }