#include using namespace std; int main(){int n,m=1e9+7;long long c,d,r=0;cin>>n;for(int i=0;i>c>>d;r=(r+(((c+1)/2)%m)*d%m)%m;}cout<