#include using namespace std; int main(){ int n; unsigned long long ans = 0; scanf("%d", &n); for(int i = 0; i < n; i++){ unsigned long long c, d; scanf("%llu %llu", &c, &d); ans += (unsigned long long)((c + 1) / 2) * d; } printf("%llu\n", ans); return 0; }