#include using namespace std; using ll = unsigned long long int; ll Multiplation(ll a,ll b){ if(b == 0){ return 0; } ll tmp = 2*Multiplation(a,b>>1); tmp %= 1000000007; if(b%2 == 1){ tmp += a; tmp %= 1000000007; return tmp; }else{ return tmp; } } int main(void){ // Here your code ! int n; cin >> n; ll res = 0; for(int i = 0; i < n; i++){ ll c,d; cin >> c >> d; c %= 1000000007; d %= 1000000007; c = (c+1)/2; res += c*d; res %= 1000000007; } cout << res << endl; }