#include #include #include #include #define N_MAX 100000 #define M_NUM 1000000007 using namespace std; typedef long long LL; int main() { int N; LL C, D, ans=0; cin >> N; for (int i = 0; i < N; ++i) { cin >> C >> D; ans += (((C+1) / 2)*D )%M_NUM; } cout << ans; return 0; }