#include using namespace std; int main(){ int n; unsigned long long ans = 0; scanf("%d", &n); for(int i = 0; i < n; i++){ unsigned long long c, d; scanf("%llu %llu", &c, &d); c += 1; c /= 2; c %= 1000000007; c *= d; c %= 1000000007; ans += c; ans %= 1000000007; } printf("%llu\n", ans); return 0; }