#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin >> n;
    double p[n];
    double q[n + 1];
    double dp[n + 1][n + 1];
    for (int i = 0; i < n; i++)
        cin >> p[i];
    for (int i = 0; i <= n; i++)
    {
        cin >> q[i];
        dp[i][i] = q[i];
    }
    double pSum[n][n];
    for (int i = 0; i < n; i++)
    {
        pSum[i][i] = p[i];
        for (int j = i + 1; j < n; j++)
            pSum[i][j] = pSum[i][j - 1] + p[j];
    }
    double qSum[n + 1][n + 1];
    for (int i = 0; i < n + 1; i++)
    {
        qSum[i][i] = q[i];
        for (int j = i + 1; j < n + 1; j++)
            qSum[i][j] = qSum[i][j - 1] + q[j];
    }
    for (int i = 1; i < n + 1; i++)
    {
        for (int j = 0; j < n + 1 - i; j++)
        {
            dp[j][j + i] = 1145141919;
            for (int k = 0; k < i; k++)
            {
                double tmp = dp[j][j + k] + dp[j + k + 1][j + i] + pSum[j][j + i - 1] + qSum[j][j + i];
                dp[j][j + i] = min(dp[j][j + i], tmp);
            }
        }
    }
    printf("%.8f\n", dp[0][n]);
}
