N = int(input()) A = list(map(int,input().split())) M = int(input()) B = list(map(int,input().split())) B.sort(reverse=True) S = [0] * (1<