import java.io.PrintWriter

fun main(args: Array<String>) {
    PrintWriter(System.out).use { out ->
        solve(out)
        out.flush()
    }
}

fun solve(out: PrintWriter) {
    val n = readInteger()
    val tList = readIntegerList()
    val vList = readIntegerList().map { it * 10 }

    val times = tList.sum() * 2 + 1
    val maxVs = IntArray(times) { Int.MAX_VALUE }
    maxVs[0] = 0
    maxVs[times - 1] = 0
    var curT = 0
    for ((i, t) in tList.withIndex()) {
        for (j in 0..(2 * t)) {
            if (curT + j in 0 until times) {
                maxVs[curT + j] = Math.min(maxVs[curT + j], vList[i]) // 境界値難しい...
            }
        }
        curT += 2 * t
    }

    for (i in 0 until (times - 1)) {
        maxVs[i + 1] = Math.min(maxVs[i + 1], maxVs[i] + 5)
    }

    for (i in (times - 1) downTo 1) {
        maxVs[i - 1] = Math.min(maxVs[i - 1], maxVs[i] + 5)
    }

    var ans = 0
    var preV = maxVs.first()
    for (v in maxVs.drop(1)) {
        ans += preV + v
        preV = v
    }
    println(ans / 40.0)
}

fun readInteger() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)
fun readLongList() = readStringList().map(String::toLong)
fun readDoubleList() = readStringList().map(String::toDouble)
