N persons are standing in a row. The height of the i-th person from the front is A_i.  We want to have each person stand on a stool of some heights - at least zero - so that the following condition is satisfied for every person:  Condition: Nobody in front of the person is taller than the person. Here, the height of a person includes the stool.  Find the minimum total height of the stools needed to meet this goal.

item = input().split()
total_num = item[0]
fumidai_sum = 0
before_tall = 0

for idx, tall in enumerate(item[1:]):
  tall = int(tall)
  
  if idx == 0:
    before_tall = tall
    continue
  else:
    if before_tall > tall:
      fumidai_sum += (before_tall - tall)
    else:
      before_tall = tall
      
print(fumidai_sum)
num = int(input())
item = input().split()
res = 0

for i in range(num):
  if i == 0:
    continue
  b = int(item[i - 1])
  t = int(item[i])
  
  if b > t:
    res += (b - t)
    item[i] = b
    
      
print(res)