N = gets.to_i
V = gets.chomp.split(" ").map(&:to_i)
C = gets.chomp.split(" ").map(&:to_i)
X = []
Y = []
for i in 1..N do
  cash =  V.permutation(i).to_a
  for j in 0...cash.length do
    X << cash[j].inject(:+)
  end
end
for i in 1..N do
  cash =  C.permutation(i).to_a
  for j in 0...cash.length do
    Y << cash[j].inject(:+)
  end
end
judg = X[0]-Y[0]
for i in 1...X.length do
  if X[i]-Y[i] > judg then
    judg = X[i]-Y[i]
  end
end
if judg < 0 then
  judg = 0
end
puts judg