# Optimal Pair Selection Score
## Problem Statement
You are given an array of $2N$ positive integers. You must perform exactly $N$ operations to pair up all elements. In each operation, you select two remaining elements from the array, compute a score based on their greatest common divisor (GCD), and then remove both elements from the array.
The score for the $i$-th operation (1-indexed) is calculated as $i$ multiplied by the greatest common divisor of the two selected elements, i.e., $i \times \text{gcd}(x, y)$.
Your goal is to determine the optimal pairing strategy that maximizes the total score across all $N$ operations. The order in which you pair elements significantly affects the total score, as later operations have higher multipliers.
## Input Format
- The first line contains a single integer $N$ ($1 \le N \le 7$), representing the number of pairing operations.
- The second line contains $2N$ space-separated integers $a_1, a_2, \dots, a_{2N}$ ($1 \le a_i \le 10^5$), representing the elements of the array.
## Output Format
Print a single integer representing the maximum total score achievable through optimal pairing.
## Sample Test Cases
### Sample Input 1
```
2
3 4 6 8
```
### Sample Output 1
```
11
```
## Constraints
- $1 \le N \le 7$
- $2 \le 2N \le 14$
- $1 \le a_i \le 10^5$ for all $i$ from $1$ to $2N$.
- Time limit: 1 second
- Memory limit: 256 MB
## Explanation
For the given input: $N = 2$ and elements are $3, 4, 6, 8$.
One possible pairing strategy:
1. **Operation 1:** Pair $(3, 6)$. Score $= 1 \times \text{gcd}(3, 6) = 1 \times 3 = 3$. Remaining elements: $4, 8$.
2. **Operation 2:** Pair $(4, 8)$. Score $= 2 \times \text{gcd}(4, 8) = 2 \times 4 = 8$. Remaining elements: empty.
Total score $= 3 + 8 = 11$.
Consider another pairing strategy:
1. **Operation 1:** Pair $(3, 4)$. Score $= 1 \times \text{gcd}(3, 4) = 1 \times 1 = 1$. Remaining elements: $6, 8$.
2. **Operation 2:** Pair $(6, 8)$. Score $= 2 \times \text{gcd}(6, 8) = 2 \times 2 = 4$. Remaining elements: empty.
Total score $= 1 + 4 = 5$.
The strategy yielding a total score of $11$ is optimal.
Loading problem statement...