Imports System
Public Class test
 Public shared Sub Main()
        Dim n As Integer
        Dim TT As String
        Dim VV As String
        n = Console.ReadLine()
        TT = Console.ReadLine()
        VV = Console.ReadLine()
        Dim TTT As String() = TT.Split(" "c)
        Dim VVV As String() = VV.Split(" "c)
        Dim v(n) As Integer
        Dim t(n) As Integer
        Dim i As Integer = 1
        For Each vk As String In VVV
            v(i) = vk
            i += 1
        Next vk
        i = 1
        t(0) = 0
        For Each tk As String In TTT
            t(i) = tk + t(i - 1)
            i += 1
        Next tk
        v(0) = 0

        Dim bv As Single = 0
        Dim av As Single = 0
        Dim distance As Single = 0
        For j As Single = 0 To t(n) Step 0.5
            bv = av
            av = j
            For k As Integer = 1 To n
                If (velo(j, t(k - 1), t(k), v(k)) < av) Then
                    av = velo(j, t(k - 1), t(k), v(k))
                End If
            Next
            If t(n) - j < av Then
                av = t(n) - j
            End If
            distance += 0.25 * (av + bv)
            'Console.WriteLine(j & vbTab & bv & vbTab & av & vbTab & distance)
        Next
        Console.WriteLine(distance)
        'Console.ReadKey()
    End Sub
    Function velo(time As Single, a As Single, b As Single, ve As Integer) As Single
        If (time < a) Then
            Return -time + a + ve
        ElseIf (time > b) Then
            Return time + ve - b
        Else
            Return ve
        End If
    End Function
End Class