def bb
    n = gets.chomp.to_i
    v = gets.chomp.split(/\s/).map{|x| x.to_i}
    c = gets.chomp.split(/\s/).map{|x| x.to_i}

    cost = 0
    for i in 1..n
        j = i - 1
        cost += v[j]-c[j] if v[j] > c[j]
    end

    puts cost
end

bb