#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define MOD 1000000007 #define INF 11234567890 #define in std::cin #define out std::cout #define rep(i,N) for(LL i=0;i P; LL N, C[112345], D[112345]; LL ans; int main() { in >> N; rep(i, N) { in >> C[i] >> D[i]; if (C[i] % 2 == 1) { ++C[i]; } C[i] /= 2; C[i] %= MOD, D[i] %= MOD; } rep(i, N) { ans += (C[i] * D[i]) % MOD; ans %= MOD; } out << ans << std::endl; return 0; }