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