using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _20190118_AOJ
{
    class ALDS1_10D
    {
        static double[,] sumTable;

        static void Main(string[] args)
        {
            for (;;)
            {
                string line = Console.ReadLine();
                if (string.IsNullOrEmpty(line))
                {
                    break;
                }

                int n = int.Parse(line);

                double[] arrP = Console.ReadLine().Split(' ').Select(x => double.Parse(x)).ToArray();
                double[] arrQ = Console.ReadLine().Split(' ').Select(x => double.Parse(x)).ToArray();

                double[] arr = new double[2 * n + 1];
                for (int i = 0; i < n; i++)
                {
                    arr[2 * i] = arrQ[i];
                    arr[2 * i + 1] = arrP[i];
                }
                arr[2 * n] = arrQ[n];

                CreateSumTable(arr);
                //double ans = OptCost(arr, 0, 2 * n);
                double ans = OptimalSearchTree(arr, 2 * n + 1);
                Console.WriteLine(ans);
            }
        }

        static double OptCost(double[] freq, int i, int j)
        {
            if (j < i)
                return 0;

            if (j == i)
                return freq[i];

            //double fsum = Sum(freq, i, j);
            double fsum = sumTable[i, j];

            double min = double.MaxValue;

            for (int r = i; r <= j; ++r)
            {
                if (r % 2 == 0)
                {
                    continue;
                }

                double cost = OptCost(freq, i, r - 1)
                    + OptCost(freq, r + 1, j);
                if (cost < min)
                {
                    min = cost;
                }
            }

            return min + fsum;
        }

        static double Sum(double[] freq, int i, int j)
        {
            double s = 0;
            for (int k = i; k <= j; k++)
                s += freq[k];
            return s;
        }

        static void CreateSumTable(double[] freq)
        {
            int len = freq.Length;
            sumTable = new double[len, len];

            for (int i = 0; i < len; i++)
            {
                sumTable[i, i] = freq[i];
            }

            for (int i = 0; i < len - 1; i++)
            {
                for (int j = i + 1; j < len; j++)
                {
                    sumTable[i, j] = sumTable[i, j - 1] + freq[j];
                }
            }
        }

        static double OptimalSearchTree(double[] freq, int n)
        {
            double[,] cost = new double[n, n];

            for (int i = 0; i < n; i++)
            {
                cost[i, i] = freq[i];
            }

            for (int L = 2; L <= n; L++)
            {
                for (int i = 0; i < n - L + 1; i++)
                {
                    int j = i + L - 1;
                    cost[i, j] = double.MaxValue;

                    for (int r = i; r <= j; r++)
                    {
                        if (r % 2 == 0)
                        {
                            continue;
                        }

                        double c =
                            ((r > i) ? cost[i, r - 1] : 0) +
                            ((r < j) ? cost[r + 1, j] : 0) +
                            sumTable[i, j];
                        if (c < cost[i, j])
                        {
                            cost[i, j] = c;
                        }
                    }
                }
            }

            return cost[0, n - 1];
        }
    }
}



Measured memory_bytes: 30488