# -*- coding:utf-8 -*- # http://yukicoder.me/problems/369 import math if __name__ == '__main__': n = int(input()) cnt = 0 for _ in range(n): c, d = map(int, input().split()) cnt += math.ceil(c/2) * d print(cnt)