#include using namespace std; #define MOD (1000000000+7) int main(){ long long N,C,D,ans=0; cin>>N; for(int i=0;i>C>>D; C%=MOD; D%=MOD; ans+=D; C--; ans+=(long long)(C/2)*D; ans%=MOD; } cout<