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

public class VasyaAndTheMushrooms {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader inp = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Solver solver = new Solver();
        solver.solve(inp, out);
        out.close();
    }

    static class Solver {

        private void solve(InputReader inp, PrintWriter out) {
            int n = inp.nextInt();
            int[][] f = new int[2][n];
            for (int i = 0; i < n; i++) f[0][i] = inp.nextInt();
            for (int i = 0; i < n; i++) f[1][i] = inp.nextInt();

            long route1 = 0;
            int x = 0, y = 0;
            for (int i = 0; i < 2 * n; i++) {
                route1 += i * f[y][x];
                if (x < n - 1 && y == 0) x++;
                else if (x == n - 1 && y == 0) y++;
                else if (y == 1) x--;
            }

            long route2 = 0;
            x = 0;
            y = 0;
            for (int i = 0; i < 2 * n; i++) {
                route2 += i * f[y][x];
                if (i % 4 == 0) y++;
                else if (i % 4 == 2) y--;
                else x++;
            }

            long route3 = 0;
            x = 0;
            y = 0;
            for (int i = 0; i < 2 * n; i++) {
                route3 += i * f[y][x];
                if (x == 0 && y == 0) y++;
                else if (y == 1 && x == n - 1) y--;
                else if (y == 1) x++;
                else x--;
            }

            out.print(Math.max(Math.max(route1, route2), route3));
        }
    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }
    }
}
