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