#include #include typedef long long ll; typedef unsigned long long ul; int main(void) { std::cin.tie(0); std::ios::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(3); ll n; std::cin >> n; ul ans = 0; for (ul i = 0; i < n; ++i) { ul c, d; std::cin >> c >> d; ans += ((c+1)/2%1000000007) * (d % 1000000007) % 1000000007; ans %= 1000000007; } std::cout << ans << std::endl; return 0; }