Sigma Problem

AtCoder
IDabc353_c
Time2000ms
Memory256MB
Difficulty
For positive integers $x$ and $y$, define $f(x, y)$ as the remainder of $(x + y)$ divided by $10^8$. You are given a sequence of positive integers $A = (A_1, \ldots, A_N)$ of length $N$. Find the value of the following expression: $\displaystyle \sum_{i=1}^{N-1}\sum_{j=i+1}^N f(A_i,A_j)$. ## Constraints * $2 \leq N \leq 3\times 10^5$ * $1 \leq A_i < 10^8$ * All input values are integers. ## Input The input is given from Standard Input in the following format: $N$ $A_1$ $\ldots$ $A_N$ [samples]
Samples
Input #1
3
3 50000001 50000002
Output #1
100000012

*   $f(A_1,A_2)=50000004$
*   $f(A_1,A_3)=50000005$
*   $f(A_2,A_3)=3$

Thus, the answer is $f(A_1,A_2) + f(A_1,A_3) + f(A_2,A_3) = 100000012$.
Note that you are not asked to compute the remainder of the sum divided by $10^8$.
Input #2
5
1 3 99999999 99999994 1000000
Output #2
303999988
API Response (JSON)
{
  "problem": {
    "name": "Sigma Problem",
    "description": {
      "content": "For positive integers $x$ and $y$, define $f(x, y)$ as the remainder of $(x + y)$ divided by $10^8$. You are given a sequence of positive integers $A = (A_1, \\ldots, A_N)$ of length $N$. Find the valu",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc353_c"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "For positive integers $x$ and $y$, define $f(x, y)$ as the remainder of $(x + y)$ divided by $10^8$.\nYou are given a sequence of positive integers $A = (A_1, \\ldots, A_N)$ of length $N$. Find the valu...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments