You are given two integer arrays a and b of length n.

You can reverse at most one subarray (continuous subsegment) of the array a. 

Your task is to reverse such a subarray that the sum ∑_{i=1}^n a_i ⋅ b_i is maximized.

Input

The first line contains one integer n (1 ≤ n ≤ 5000).

The second line contains n integers a_1, a_2, ..., a_n (1 ≤ a_i ≤ 10^7).

The third line contains n integers b_1, b_2, ..., b_n (1 ≤ b_i ≤ 10^7).

Output

Print single integer — maximum possible sum after reversing at most one subarray (continuous subsegment) of a.

Examples

Input


5
2 3 2 1 3
1 3 2 4 2


Output


29


Input


2
13 37
2 4


Output


174


Input


6
1 8 7 6 3 6
5 9 6 8 8 6


Output


235

Note

In the first example, you can reverse the subarray [4, 5]. Then a = [2, 3, 2, 3, 1] and 2 ⋅ 1 + 3 ⋅ 3 + 2 ⋅ 2 + 3 ⋅ 4 + 1 ⋅ 2 = 29.

In the second example, you don't need to use the reverse operation. 13 ⋅ 2 + 37 ⋅ 4 = 174.

In the third example, you can reverse the subarray [3, 5]. Then a = [1, 8, 3, 6, 7, 6] and 1 ⋅ 5 + 8 ⋅ 9 + 3 ⋅ 6 + 6 ⋅ 8 + 7 ⋅ 8 + 6 ⋅ 6 = 235.
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;

public class Run {
    static final long mod = (long) 1e9 + 7;
    static InputReader in = new InputReader(System.in);
    static PrintWriter pw = new PrintWriter(System.out);
    static long inf = (long) -1e8;
    static long ss = 0;
    static int MAX_N = (int) 1e8 + 9;

    public static void main(String args[]) {

        int t = 1;
//        t = in.nextInt();
        for (int i = 1; i <= t; i++) {
            solve();
        }
        pw.flush();
        pw.close();
    }

    private static void solve() {
        int n = in.nextInt();
        long[] a = new long[n + 2];
        long b[] = new long[n + 2];
        long c[] = new long[n + 2];
        long dp[][] = new long[n + 2][n + 2];
        for (int i = 1; i <= n; i++) {
            a[i] = in.nextLong();
        }
        for (int i = 1; i <= n; i++) {
            b[i] = in.nextLong();
        }

        for (int i = 1; i <= n; i++) {
            c[i] = c[i - 1] + a[i] * b[i];
        }
        long ans = c[n];
        for (int i = 0; i <= n; i++) {
            for (int j = 1; j  <= n - i ; j++) {
                if( i == 0) {
                    dp[j][j] =  a[j] * b[j];
                    continue;
                }
                if (i == 1) {
                    dp[j][j+1] = a[j] * b[j+1] + a[j + 1]  * b[j];
                    long p = c[n] -  c[j + i] + c[j-1] + dp[j][j+1];
                    ans = Math.max(p,ans);
                    continue;
                }
                dp[j][j + i] = dp [j+1][ j + i - 1] + a[j] * b[j+i] + a[j + i]  * b[j];
                long p = c[n] -  c[j + i] + c[j-1] + dp[j][j+i];
                ans = Math.max(p,ans);
            }

        }
        System.out.println(ans);
    }

    private static long add(long a, long b, long m) {
        return ((a % m) + (b % m)) % m;
    }

    private static void dfs(Set<Integer>[] rev, boolean[] vis, int v) {
        vis[v] = true;
        for (int u : rev[v]) {
            if (vis[u]) continue;
            dfs(rev, vis, u);
        }

    }

    private static void topSort(ArrayList<Integer> top, ArrayList<Integer>[] g, int v, boolean[] vis) {
        vis[v] = true;
        for (int u : g[v]) {
            if (vis[u]) continue;
            topSort(top, g, u, vis);
        }
        top.add(v);
    }

    public static long gcd(long a, long b) {
        if (b != 0)
            return gcd(b, a % b);
        else
            return a;
    }


    static long maxSubArraySum(ArrayList<Long> a) {
        int size = a.size();
        long max_so_far = Integer.MIN_VALUE, max_ending_here = 0;

        for (int i = 0; i < size; i++) {
            max_ending_here = max_ending_here + a.get(i);

            if (max_so_far < max_ending_here)
                max_so_far = max_ending_here;
            if (max_ending_here < 0) {
                max_ending_here = 0;
            }
        }
        return Math.max(0l, max_so_far);
    }

    private static long ncr(long n, long k, long[] fact) {
        if (n < k) return 0;
        long ret = fact[(int) n];
        ret = (ret * pow(fact[(int) (n - k)], mod - 2, mod)) % mod;
        ret = (ret * pow(fact[(int) (k)], mod - 2, mod)) % mod;

        return ret;

    }

    private static long pow(long a, long b, long mod) {
        if (b == 0) return 1;
        if (b == 1) return a % mod;
        long t = pow(a, b / 2, mod);
        t = (t * t) % mod;
        if (b % 2 != 0) {
            t = (t * a) % mod;
        }
        return t;
    }

    private static int[] bfs(ArrayList<Integer>[] g, int a, int n) {
        int dist[] = new int[n + 1];
        for (int i = 0; i < n + 1; i++) {
            dist[i] = n + 10;
        }
        Queue<Integer> q = new LinkedList<>();
        boolean vis[] = new boolean[n + 1];
        dist[a] = 0;
        q.add(a);
        while (!q.isEmpty()) {
            int p = q.poll();
            if (vis[p] == true) {
                continue;
            }
            vis[p] = true;
            for (Integer i : g[p]) {
                if (!vis[i]) {
                    dist[i] = Integer.min(dist[i], dist[p] + 1);
                    q.add(i);
                }
            }
        }
        return dist;
    }

    static class InputReader {

        private final InputStream stream;
        private final byte[] buf = new byte[8192];
        private int curChar, snumChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int snext() {
            if (snumChars == -1)
                throw new InputMismatchException();
            if (curChar >= snumChars) {
                curChar = 0;
                try {
                    snumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (snumChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = snext();
            while (isSpaceChar(c)) {
                c = snext();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public long nextLong() {
            int c = snext();
            while (isSpaceChar(c)) {
                c = snext();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int[] nextIntArray(int n) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = nextInt();
            }
            return a;
        }

        public String readString() {
            int c = snext();
            while (isSpaceChar(c)) {
                c = snext();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = snext();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public String nextLine() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = snext();
            } while (!isEndOfLine(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        private boolean isEndOfLine(int c) {
            return c == '\n' || c == '\r' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }


}
