Treasure

Given two arrays A and B, rearrange A (B stays fixed) to minimize the sum of elementwise products, using the sorted pairing strategy.

Easy3GreedySortingArrayInterviewNo attempts yetTime limit2sMemory limit128 MB

Problem

You are given two integer arrays A and B, each of length N. Define the function S as follows.

S=A0×B0+A1×B1++AN1×BN1S = A_0 \times B_0 + A_1 \times B_1 + \cdots + A_{N-1} \times B_{N-1}

You may freely rearrange the elements of A, but the elements of B must keep their given order. Write a program that finds the minimum possible value of S.

Input

The first line contains the array length N. The second line contains the N elements of array A in order, and the third line contains the N elements of array B in order.

N is a natural number not greater than 50, and every element of A and B is a non-negative integer not greater than 100.

Output

Print the minimum value of S on the first line.

Hint

To make S as small as possible, pair the largest values of A with the smallest values of B.