N = int(input())

ans = 0
for _ in range(N):
    a, b = map(int, input().split())
    ans += a*b
print(int(ans*1.05))

N = int(input())

ans = 0
for _ in range(N):
    a, b = map(int, input().split())
    ans += a*b
print(int(ans*1.05))
