fun main(arg: Array<String>) {
    val N = nextInt()
    val T = listOfInt().map { it * 2 }
    val V = listOfLong().map { it * 2 }
    val R = T.sum()
    val M = LongArray(R + 1) { 1001001001L }
    M[0] = 0; M[R] = 0
    var m = 0
    for (n in 0 until N) {
        for (t in 0 .. T[n]) M[m + t] = Math.min(M[m + t], V[n])
        m += T[n]
    }
//System.err.println(M.joinToString())
    for (n in 1 .. R) M[n] = Math.min(M[n], M[n - 1] + 1)
    for (n in R - 1 downTo 0) M[n] = Math.min(M[n], M[n + 1] + 1)
//System.err.println(M.joinToString())
    var ans = M.sumByDouble { 0.0 + it } / 4.0
    println(ans)
}

fun next() = readLine()!!
fun nextInt(delta: Int = 0) = Integer.parseInt(next()) + delta
fun listOfString() = next().split(" ")
fun listOfInt(d: Int = 0) = listOfString().map { Integer.parseInt(it) + d }
fun listOfLong() = listOfString().map(String::toLong)
fun listOfDouble() = listOfString().map { it.toDouble() }
