You are given an Array of 2N positive integers.There are N rounds in total.You have to choose any 2 positive integers from an array and delete them.

Your score in each round will be gcd(num1,num2) * round_number where num1 and num2 are the. number you have chosen and round_number is the current round. Your total score will be the summation that you have obtained in every round.

Determine the total score.

Round starts from 1.

**CONSTRIANT : 1<=N<=10**

EXAMPLE

N=3

A=[8 5 6 25 6 16]

ROUND 1 = gcd(5,25) *Round_number = 5* 1=5

ROUND 1 = gcd(6,6) *Round_number = 6* 2=12

ROUND 1 = gcd(8,16) *Round_number = 8* 3=24

MAXIMUM= 5+12+24= 41

EXAMPLE 2

N=

A=[3 4 9 5]

ROUND 1 = gcd(4 ,5 ) *Round_number = 1* 1=1

ROUND 1 = gcd(3,9) *Round_number = 3* 2=6

MAXIMUM=1+6=7

…

I try greedy and brute force (maximum gcd * maximum round no.) but wrong ans on some test case. I finded out it was DP problem.

Eg: 6 5 6 30

gcd(30,6)*2+gcd(6,5) * 1

6 * 2+1 * 1= 13 (brute forca)

**But correct anser **

**2 * gcd(6,6) + 1 * gcd(5,30)**

**2 * 6 + 1 * 5 = 17 (not brute forc**e)