#include using namespace std; typedef unsigned long long ull; typedef long long ll; #define mod ((ll)(1e9)+7) int main(){ int n; cin >> n; ll ans=0; for(int i=0; i> c >> d; ll t=(((c+1)/2)%mod)*(d%mod)%mod; ans+=t; ans%=mod; } cout << ans << endl; return 0; }