#P3909. 异或之积

异或之积

Description

For A1,A2,A3,,ANA_1, A_2, A_3, \cdots, A_N, compute

$$(6\times \sum_{i=1}^N\sum_{j=i+1}^N\sum_{k=j+1}^N A_i\times A_j\times A_k) \bmod (10^9+7)$$

Input Format

Line 1: one integer NN.

Line 2: NN integers A1,A2,A3,,ANA_1, A_2, A_3, \cdots, A_N.

Output Format

One integer, representing the required value.

3
1 2 3
36

Hint

  • For 30% of the testdata, N500N \le 500.
  • For 60% of the testdata, N5000N \le 5000.
  • For 100% of the testdata, 3N1063 \le N \le 10^6, 0Ai1090 \le A_i \le 10^9.

Translated by ChatGPT 5