#include int main(void) { int i, N; long long int C, D, sum; scanf("%d", &N); sum = 0; for(i = 1;i <= N;i++){ scanf("%lld%lld", &C, &D); sum += (((C + 1) / 2) * D) % 1000000007; sum %= 1000000007; } printf("%lld\n", sum); return 0; }