# -*- coding: utf-8 -*- """ No.146 試験監督(1) https://yukicoder.me/problems/no/146 """ import sys from sys import stdin input = stdin.readline def main(args): ans = 0 N = int(input()) for _ in range(N): C, D = map(int, input().split()) capacity = (C + 1) // 2 ans += capacity * D print(ans) if __name__ == '__main__': main(sys.argv[1:])