#include using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x>N; FOR(i,N) { cin>>C[i]>>D[i]; ret +=((C[i]+1)/2%mo)*(D[i]%mo)%mo; ret %= mo; } cout<