6
12 8 12 17 20 5
17 4 8 8 8 4
 6
4 1 12 9 3 11
12 20 19 12 19 11
 1
1
1
 2
1 2
1 1
 1
7
5
 6
16 20 18 7 14 2
17 12 4 10 7 4

705
 917
 1
 9
 5
 741

import java.util.*;
import java.io.*;
import static java.lang.Math.*;
public class Main
{  
    static MyScanner scan;
    static PrintWriter pw;
    static int n;
    static long a[],b[],suffsum[],dp[][];
    public static void main(String[] args) {
        new Thread(null,null,"_",1<<25)
        {
           public void run()
           {
               try
               {
                   solve();
               }
               catch(Exception e)
               {  
                   e.printStackTrace();
                   System.exit(1);
               }
           }
        }.start();
    }
    static void solve() throws IOException
    {
        scan = new MyScanner();
        pw = new PrintWriter(System.out,true);
        StringBuilder sb = new StringBuilder();
        n = ni();
        a = new long[n];
        b = new long[n];
        suffsum = new long[n+1];
        dp = new long[n][2];
        for(int i=0;i<n;++i)
            a[i] = ni();
        for(int i=0;i<n;++i)
            b[i] = ni();
        for(int i=n-1;i>=0;--i)
        {
            suffsum[i] = suffsum[i+1]+a[i]+b[i];
            dp[i][0] = dp[i][1] = -1;
        }
        pl(f(0,1)-suffsum[0]);
        pw.flush();
        pw.close();
    }
    static long f(int idx,int upar)
    {
        if(idx==n)
            return 0;
        if(dp[idx][upar]!=-1)
            return dp[idx][upar];
        long way1,way2;
        if(upar==1)
        {
            way1 =  a[idx]+b[idx]*(n-idx)*2+f(idx+1,upar)+suffsum[idx+1];
            way2 = a[idx]+b[idx]*2+f(idx+1,upar^1)+suffsum[idx+1]*2;
        }
        else
        {
            way1 = b[idx]+a[idx]*(n-idx)*2+f(idx+1,upar)+suffsum[idx+1];
            way2 = b[idx]+a[idx]*2+f(idx+1,upar^1)+suffsum[idx+1]*2;
        }
        return dp[idx][upar] = max(way1,way2);
    }
    static int ni() throws IOException
    {
        return scan.nextInt();
    }
    static long nl() throws IOException
    {
        return scan.nextLong();
    }
    static double nd() throws IOException
    {
        return scan.nextDouble();
    }
    static String ne() throws IOException
    {
        return scan.next();
    }
    static String nel() throws IOException
    {
        return scan.nextLine();
    }
    static void pl()
    {
        pw.println();
    }
    static void p(Object o)
    {
        pw.print(o+" ");
    }
    static void pl(Object o)
    {
        pw.println(o);
    }
    static void psb(StringBuilder sb)
    {
        pw.print(sb);
    }
    static class MyScanner
    {
        BufferedReader br;
        StringTokenizer st;
        MyScanner()
        {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        String nextLine()throws IOException
        {
            return br.readLine();
        }
        String next() throws IOException
        {
            if(st==null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }
        int nextInt() throws IOException
        {
            return Integer.parseInt(next());
        }
        long nextLong() throws IOException
        {
            return Long.parseLong(next());
        }
        double nextDouble() throws IOException
        {
            return Double.parseDouble(next());
        }
    }
}