#include #include #include #include #define ALL(x) (x).begin(),(x).end() #define REP(i,n) for(int i = 0;i < (n);i++) #define PI 3.14159265359 #define MOD 1000000007 using namespace std; int main(){ long long n,ans = 0; cin >> n; REP(i,n){ long long c,d; cin >> c >> d; c = (c+1)/2; ans = (ans + c%MOD * (d%MOD))%MOD; } cout << ans << endl; return 0; }