#include using namespace std; int main() { long long n,s=0,a,b,M=1e9+7;cin>>n; for(int i=0;i>a>>b,s=(s+((((a+1LL)>>1)%M)*(b%M))%M)%M; cout<