fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
    val t = (listOf(0) + readLine()!!.split(" ").map{it.toInt()} + listOf(0)).toIntArray()
    val v = listOf(0) + readLine()!!.split(" ").map{it.toInt()} + listOf(0)

    for (i in 1 until t.size) {
        t[i] += t[i - 1]
    }

    val mx = Array(20010) { 0 }
    val mx2 = Array(20010) { 0 }

    for (i in 1 .. N) {
        mx[t[i-1]] = Math.min(v[i - 1], v[i])
        mx2[t[i-1]] = v[i]
        for (j in t[i - 1] + 1 until t[i]) {
            mx[j] = v[i]
            mx2[j] = v[i]
        }
    }

    val a = Array(20010) { 0 }

    for (k in 1..110) {
        for (i in 1 until 20008) {
            if (a[i - 1] - a[i] >= 0 && a[i + 1] - a[i] >= 0 && a[i] + 1 <= mx[i]) {
                a[i]++
            }
        }
    }

    var res = 0.0

    for(i in 1 until a.size) {
        if (a[i - 1] == a[i] && a[i - 1] < mx2[i - 1]) {
            res += a[i] + 0.25
        } else {
            res += (a[i - 1] + a[i]) / 2.0
        }
    }

    System.out.printf("%1.10f\n", res)
}
