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.awt.color.*;
import java.util.*;


import java.awt.Point;
import java.math.*;
import java.io.*;
@SuppressWarnings("unused")
public class dp {int[] b;	String g="";int c=0;int M=1000000000+7;ArrayList<Long> list=new ArrayList<Long>();String s;int[] size;int[] id;
int[]ab;int[] data;int mod=100000;LinkedList<Integer> queue=new LinkedList<Integer>();int dis=0;int max=0;ArrayList<Integer>[] arr;
	public static void main(String[] args) {
                new dp().solve();
                                  }
	long[] fact;long[] inv;
            public void solve() {
           int n=sc.nextInt();
          int[] a=new int[n];int[] b=new int[n];
          for(int i=0;i<n;i++) {
        	  a[i]=sc.nextInt();
          }
          for(int i=0;i<n;i++) {
        	  b[i]=sc.nextInt();
          }
           long upar=b[n-1]+2*a[n-1];
           long niche=a[n-1]+2*b[n-1];long str=a[n-1]+2*b[n-1];
           long dia=b[n-1]+2*a[n-1];
           long add=a[n-1]+b[n-1];
           
           for(int i=n-2;i>=0;i--) {
        	long add2=a[i]+b[i]+add;
        	dia+=add+b[i]+a[i]*(n-i)*2;
        	str+=add+a[i]+b[i]*(n-i)*2;
        	long s1=Math.max(2*add+a[i]+b[i]*2+upar,str );
        	long s2=Math.max(2*add+b[i]+a[i]*2+niche, dia);
        	add=add2;niche=s1;upar=s2;
           }
           
           System.out.println(niche-add);
            	
                }
            	

               
      public class Node{
	     long x;long color;long y;
	       Node par;
	        public Node(long a,long b,long c) {
	          	x=a;y=b;color=c;
		
	             }
                  }
              class sortbyweight implements Comparator<Node>{

				@Override
				public int compare(Node arg0, Node arg1) {
					// TODO Auto-generated method stub
					
					return (int)(arg0.color-arg1.color);
				}}
				
				 FastReader sc=new FastReader();
				 static class FastReader
				     {
				         BufferedReader br;
				         StringTokenizer st;
				  
				         public FastReader()
				         {
				             br = new BufferedReader(new
				                      InputStreamReader(System.in));
				         }
				  
				         String next()
				         {
				             while (st == null || !st.hasMoreElements())
				             {
				                 try
				                 {
				                     st = new StringTokenizer(br.readLine());
				                 }
				                 catch (IOException  e)
				                 {
				                     e.printStackTrace();
				                 }
				             }
				             return st.nextToken();
				         }
				  
				         int nextInt()
				         {
				             return Integer.parseInt(next());
				         }
				  
				         long nextLong()
				         {
				             return Long.parseLong(next());
				         }
				  
				         double nextDouble()
				         {
				             return Double.parseDouble(next());
				         }
				  
				         String nextLine()
				         {
				             String str = "";
				             try
				             {
				                 str = br.readLine();
				             }
				             catch (IOException e)
				             {
				                 e.printStackTrace();
				             }
				             return str;
				         }
				     }}
            	  
            	  