n,x = int(input()),0 for _ in range(n): c,d = map(int, input().split()) x += (c//2+c%2)*d print(x)