# -*- coding:utf-8 -*- if __name__ == '__main__': n = int(input()) cnt = 0 for _ in range(n): c, d = map(int, input().split()) cnt += int((c+1)/2) * d print(cnt)