Counting Pairs#12313

Counting Pairs

1 second
256 megabytes
Medium

Given an array of a_1,a_2,...,a_n integers , count how many pairs output answer modulus 1e6+3 (1 \le i < j \le n) such that

\Large a_i +a_j < a_i \cdot a_j < a_i^{a_j}

Input

The first line contains single integer (1 \le t \le 10^4) — the number of test cases.

The first line contains single integer (1 \le n \le 10^6) — the length of array .

The second line contains separated integers a_1,a_2,..,a_n (1 \le a_1,a_2,a_3,...,a_n \le 10^9) — the array .

It's guaranteed that \sum n \le 10^6 overall test cases.

Output

For each test case , single integer — the count of required output answer modulus 1e6+3 pairs

Examples

Example 1

Loading
Loading

Scoring

  1. Subtask ( points) : (1 \le \sum n \le 1000) and (1 \le a_i \le 9)

  2. Subtask ( points) : (1 \le a_i \le 4)

  3. Subtask ( points) : No additional constraints