It is only six months until Christmas, and AtCoDeer the reindeer is now planning his travel to deliver gifts.   There are N houses along _TopCoDeer street_. The i-th house is located at coordinate a_i. He has decided to deliver gifts to all these houses.   Find the minimum distance to be traveled when AtCoDeer can start and end his travel at any positions.
n = int(input())
A = list(set(map(int, input().split())))

ans = 0

for a_i in range(1, len(A)):
  ans += A[a_i]-A[a_i-1]
  
print(ans)
n = int(input())
A = sorted(set(map(int, input().split())))

ans = 0

for a_i in range(1, len(A)):
  ans += A[a_i]-A[a_i-1]
  
print(ans)