The following languages are only available languages for the problems from the contest

Kotlin Heroes: Episode 9 (Unrated, T-Shirts + Prizes!):

- Kotlin 1.7.20
- Kotlin 1.9.21

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

*special problem

binary search

data structures

*2400

No tag edit access

The problem statement has recently been changed. View the changes.

×
H. Sum of Digits of Sums

time limit per test

6 secondsmemory limit per test

512 megabytesinput

standard inputoutput

standard outputYou are given an array $$$[a_1, a_2, \dots, a_n]$$$, consisting of positive integers.

For every $$$i$$$ from $$$1$$$ to $$$n$$$, calculate $$$\sum \limits_{j=1}^{n} F(a_i + a_j)$$$, where $$$F(x)$$$ is the sum of digits of $$$x$$$.

Input

The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$).

The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i < 10^9$$$).

Output

Print $$$n$$$ integers. The $$$i$$$-th of them should be equal to $$$\sum \limits_{j=1}^{n} F(a_i + a_j)$$$.

Examples

Input

4 1 3 3 7

Output

18 17 17 15

Input

3 42 1337 999

Output

38 53 47

Codeforces (c) Copyright 2010-2024 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Apr/20/2024 09:44:11 (l1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|