#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; const long long mod = 1000000000+7; int main() { int n; cin>>n; unsigned long long res=0; for(int i=0;i>c>>d; res+=(((unsigned long long)ceil(c/2.0)%mod)*d)%mod; res%=mod; } cout<