def main():

	n = int(eval(input()))

	*t, = list(map(int, input().split()))

	tot = sum(t)

	*v, = list(map(int, input().split()))

	lim1 = []

	lim2 = [(1, 0, 0), (-1, tot, tot)]

	til = 0

	for t1, t2, v1 in zip([0] + t, t, v):

		lim1.append((til, til + t2, v1))

		lim2.append((-1, til, til + v1))

		lim2.append((1, til + t2, v1 - (til + t2)))

		til += t2



	def mi(time):

		ret = float("inf")

		for l, r, lim in lim1:

			if l <= time <= r:

				ret = min(ret, lim)

		for f, tt, y in lim2:

			if f == -1 and time <= tt:

				ret = min(ret, y - time)

			if f == 1 and time >= tt:

				ret = min(ret, time + y)

		return ret



	print((sum(mi(i / 2) for i in range(tot * 2 + 1)) / 2))



if __name__ == '__main__':

	main()
n,*L=list(map(int,open(0).read().split()))

T,V=L[:n],L[n:]

s=sum(T)

a=[0]

for t,v1,v2 in zip(T,V,V[1:]+[0]):

	a+=[v1]*(2*t-1)+[min(v1,v2)]

for i in range(2*s):

	a[i+1]=min(a[i+1],a[i]+.5)

for i in range(2*s,0,-1):

	a[i-1]=min(a[i-1],a[i]+.5)

print((sum(a)/2))
def main():
    n = int(eval(input()))
    (*t,) = list(map(int, input().split()))
    tot = sum(t)
    (*v,) = list(map(int, input().split()))
    lim1 = []
    lim2 = [(1, 0, 0), (-1, tot, tot)]
    til = 0
    for t1, t2, v1 in zip([0] + t, t, v):
        lim1.append((til, til + t2, v1))
        lim2.append((-1, til, til + v1))
        lim2.append((1, til + t2, v1 - (til + t2)))
        til += t2

    def mi(time):
        ret = float("inf")
        for l, r, lim in lim1:
            if l <= time <= r:
                ret = min(ret, lim)
        for f, tt, y in lim2:
            if f == -1 and time <= tt:
                ret = min(ret, y - time)
            if f == 1 and time >= tt:
                ret = min(ret, time + y)
        return ret

    print((sum(mi(i / 2) for i in range(tot * 2 + 1)) / 2))


if __name__ == "__main__":
    main()

n, *L = list(map(int, open(0).read().split()))
T, V = L[:n], L[n:]
s = sum(T)
a = [0]
for t, v1, v2 in zip(T, V, V[1:] + [0]):
    a += [v1] * (2 * t - 1) + [min(v1, v2)]
for i in range(2 * s):
    a[i + 1] = min(a[i + 1], a[i] + 0.5)
for i in range(2 * s, 0, -1):
    a[i - 1] = min(a[i - 1], a[i] + 0.5)
print((sum(a) / 2))

-def main(): -    n = int(eval(input())) -    (*t,) = list(map(int, input().split())) -    tot = sum(t) -    (*v,) = list(map(int, input().split())) -    lim1 = [] -    lim2 = [(1, 0, 0), (-1, tot, tot)] -    til = 0 -    for t1, t2, v1 in zip([0] + t, t, v): -        lim1.append((til, til + t2, v1)) -        lim2.append((-1, til, til + v1)) -        lim2.append((1, til + t2, v1 - (til + t2))) -        til += t2 - -    def mi(time): -        ret = float("inf") -        for l, r, lim in lim1: -            if l <= time <= r: -                ret = min(ret, lim) -        for f, tt, y in lim2: -            if f == -1 and time <= tt: -                ret = min(ret, y - time) -            if f == 1 and time >= tt: -                ret = min(ret, time + y) -        return ret - -    print((sum(mi(i / 2) for i in range(tot * 2 + 1)) / 2)) - - -if __name__ == "__main__": -    main() +n, *L = list(map(int, open(0).read().split())) +T, V = L[:n], L[n:] +s = sum(T) +a = [0] +for t, v1, v2 in zip(T, V, V[1:] + [0]): +    a += [v1] * (2 * t - 1) + [min(v1, v2)] +for i in range(2 * s): +    a[i + 1] = min(a[i + 1], a[i] + 0.5) +for i in range(2 * s, 0, -1): +    a[i - 1] = min(a[i - 1], a[i] + 0.5) +print((sum(a) / 2))