#define _USE_MATH_DEFINES //M_PI(π),M_SQRT2(√2) #include //std::cout, std::cin #include //std::string,std::to_string(C++11) #include //std::vector #include //std::valarray #include //std::sort #include //localtime_s #include //abs #include //abs,std::pow,sqrt,sin,cos,round,floor,ceil #include //std::ifstream,std::ofstream #include //std::setprecision,std::setw,std::setfill #include //std::random(C++11) #include //std::accumulate #include //std::greater #include //std::list int main(void) { //test用 //std::ifstream in("123.txt"); //std::cin.rdbuf(in.rdbuf()); const unsigned long long M = 1000000007; unsigned long long N = 0, C = 0, D = 0, ans = 0; std::cin >> N; for (int i = 0; i < N; i++) { std::cin >> C >> D; if (C % 2 == 0) { ans += ((C / 2) % M * (D%M))%M; } else { ans += ((C / 2 + 1) % M*(D%M)) % M; } } std::cout << ans%M << std::endl; }