#include using namespace std; using ll = long long; using P = pair; #define rep(i,n) for(int i=0;i> n; ll ans = 0l; rep(i,n){ ll c,d; cin >> c >> d; ans += (c+1)/2 * d; ans %= mod; } cout << ans << endl; return 0; }