#include #include int main() { int desk_num; std::cin >> desk_num; std::vector chest(desk_num); long long students = 0; for (int i = 0; i < desk_num; i++) { long long chest_num, desk_num; std::cin >> chest_num >> desk_num; students += ((chest_num + 1) / 2) * desk_num; } std::cout << students % 1000000007 << std::endl; return 0; }