i<n,B[i]=A[i]+A[i+1]
i=n,B[i]=A[i]