#include using namespace std; int main(){ int n; int 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; d %= 1000000007; ans += c * d; ans %= 1000000007; } printf("%d\n", ans); return 0; }