program bbb
implicit none

integer :: n, i
integer,allocatable,dimension(:) :: v, c, dp

read*, n
allocate(v(n),c(n),dp(0:n))
read*, v
read*, c
dp=0

do i=1, n
dp(i)=max(dp(i-1),dp(i-1)+v(i)-c(i))
end do

write(*,'(i0)') dp(n)

end program