#include #include #include #include #include #include using namespace std; int main(){ long long int N,sum=0,c,d,e; cin >> N; while(N--){ cin >> c >> d; e = (c+1)/2; e = e % 1000000007; d = d % 1000000007; sum += e*d; sum = sum % 1000000007; } cout << sum; return 0; }