#!/usr/bin/env python3

import sys

import numpy as np





def solve(N: int, T: "List[int]", V: "List[int]"):

    t_period = [0 for i in range(N+1)]

    for i in range(N):

        t_period[i+1] = t_period[i] + T[i]*2



    limit = np.zeros((t_period[N]+1,))

    for i in range(1, N):

        limit[t_period[i]] = min((V[i-1], V[i]))

    for i in range(N):

        limit[t_period[i]+1:t_period[i+1]] = V[i]

    

    speed = np.zeros((t_period[N]+1,))



    for v in range(1, 201):

        speed[v:t_period[N]+1-v] = np.min(

            [limit[v:t_period[N]+1-v], speed[v-1:t_period[N]-v]+0.5, speed[v+1:t_period[N]+2-v]+0.5],

            axis=0

            )



    total = 0

    for t in range(t_period[N]):

        total += (speed[t] + speed[t+1]) * 0.5 * 0.5

    

    print(total)



    return





# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)

def main():

    def iterate_tokens():

        for line in sys.stdin:

            for word in line.split():

                yield word

    tokens = iterate_tokens()

    N = int(next(tokens))  # type: int

    t = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"

    v = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"

    solve(N, t, v)



if __name__ == '__main__':

    main()

#!/usr/bin/env python3

import sys

import numpy as np





def solve(N: int, T: "List[int]", V: "List[int]"):

    t_period = [0 for i in range(N+1)]

    for i in range(N):

        t_period[i+1] = t_period[i] + T[i]*2



    V = [0] + V + [0]

    limit = np.zeros((N+2,t_period[N]+1))

    line = np.arange(0, t_period[N]/2+0.5, 0.5)

    for i in range(N+2):

        if i == 0:

            l, r = 0, 0

        elif i == N+1:

            l, r = t_period[N], t_period[N]

        else:

            l, r = t_period[i-1], t_period[i]

        limit[i] = np.max([-line + l * 0.5, line * 0, line - r * 0.5], axis=0) + V[i]

    speed = np.min(limit, axis=0)



    total = 0

    for t in range(t_period[N]):

        total += (speed[t] + speed[t+1]) * 0.5 * 0.5



    print(total)



    return





# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)

def main():

    def iterate_tokens():

        for line in sys.stdin:

            for word in line.split():

                yield word

    tokens = iterate_tokens()

    N = int(next(tokens))  # type: int

    t = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"

    v = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"

    solve(N, t, v)



if __name__ == '__main__':

    main()

#!/usr/bin/env python3
import sys
import numpy as np


def solve(N: int, T: "List[int]", V: "List[int]"):
    t_period = [0 for i in range(N + 1)]
    for i in range(N):
        t_period[i + 1] = t_period[i] + T[i] * 2
    limit = np.zeros((t_period[N] + 1,))
    for i in range(1, N):
        limit[t_period[i]] = min((V[i - 1], V[i]))
    for i in range(N):
        limit[t_period[i] + 1 : t_period[i + 1]] = V[i]
    speed = np.zeros((t_period[N] + 1,))
    for v in range(1, 201):
        speed[v : t_period[N] + 1 - v] = np.min(
            [
                limit[v : t_period[N] + 1 - v],
                speed[v - 1 : t_period[N] - v] + 0.5,
                speed[v + 1 : t_period[N] + 2 - v] + 0.5,
            ],
            axis=0,
        )
    total = 0
    for t in range(t_period[N]):
        total += (speed[t] + speed[t + 1]) * 0.5 * 0.5
    print(total)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    t = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    v = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, t, v)


if __name__ == "__main__":
    main()

#!/usr/bin/env python3
import sys
import numpy as np


def solve(N: int, T: "List[int]", V: "List[int]"):
    t_period = [0 for i in range(N + 1)]
    for i in range(N):
        t_period[i + 1] = t_period[i] + T[i] * 2
    V = [0] + V + [0]
    limit = np.zeros((N + 2, t_period[N] + 1))
    line = np.arange(0, t_period[N] / 2 + 0.5, 0.5)
    for i in range(N + 2):
        if i == 0:
            l, r = 0, 0
        elif i == N + 1:
            l, r = t_period[N], t_period[N]
        else:
            l, r = t_period[i - 1], t_period[i]
        limit[i] = np.max([-line + l * 0.5, line * 0, line - r * 0.5], axis=0) + V[i]
    speed = np.min(limit, axis=0)
    total = 0
    for t in range(t_period[N]):
        total += (speed[t] + speed[t + 1]) * 0.5 * 0.5
    print(total)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    t = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    v = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, t, v)


if __name__ == "__main__":
    main()

-    limit = np.zeros((t_period[N] + 1,)) -    for i in range(1, N): -        limit[t_period[i]] = min((V[i - 1], V[i])) -    for i in range(N): -        limit[t_period[i] + 1 : t_period[i + 1]] = V[i] -    speed = np.zeros((t_period[N] + 1,)) -    for v in range(1, 201): -        speed[v : t_period[N] + 1 - v] = np.min( -            [ -                limit[v : t_period[N] + 1 - v], -                speed[v - 1 : t_period[N] - v] + 0.5, -                speed[v + 1 : t_period[N] + 2 - v] + 0.5, -            ], -            axis=0, -        ) +    V = [0] + V + [0] +    limit = np.zeros((N + 2, t_period[N] + 1)) +    line = np.arange(0, t_period[N] / 2 + 0.5, 0.5) +    for i in range(N + 2): +        if i == 0: +            l, r = 0, 0 +        elif i == N + 1: +            l, r = t_period[N], t_period[N] +        else: +            l, r = t_period[i - 1], t_period[i] +        limit[i] = np.max([-line + l * 0.5, line * 0, line - r * 0.5], axis=0) + V[i] +    speed = np.min(limit, axis=0)