#include using namespace std; using ll = long long int; using ull = unsigned long long int; const char en ='\n'; const int mod=1000000007; int main(){ cin.tie(); ios::sync_with_stdio(false); ll n,c,d; cin>>n; ll sum=0; for(int i=0;i>c>>d; sum+=(((c+1)/2)%mod)*(d%mod); sum%=mod; } cout<