407934: GYM102946 A A Water Problem

Memory Limit:512 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

A. A Water Problemtime limit per test1 secondmemory limit per test512 megabytesinputstandard inputoutputstandard output

Alice the shark loves water. In fact, she can't live without water.

Alice has $$$n$$$ fish tanks. For $$$i=1,2,3, \dots, n$$$, the $$$i$$$-th fish tank has $$$a_i$$$ liters of water in it, where $$$a_i$$$ is a positive integer. Each fish tank has a "potential value": if it contains $$$x$$$ liters of water, then its potential $$$\mathcal{P}(x)$$$ is defined as $$$\mathcal{P}(x) = x \times \mathcal{D}(x)$$$, where $$$\mathcal{D}(x)$$$ is the sum of all digits in $$$x$$$. For example, $$$\mathcal{P}(123) = 123 \times (1 + 2 + 3) = 738$$$, and $$$\mathcal{P}(20000) = 20000 \times (2 + 0 + 0 + 0 + 0) = 40000$$$.

Please help Alice calculate the potential values of all her fish tanks.

Input

The first line contains an integer $$$n$$$. The second line contains $$$n$$$ space-separated integers $$$a_1, a_2, \dots, a_n$$$.

Technical specification:

  • $$$1 \le n \le 10^3$$$
  • $$$1 \le a_i \le 10^9$$$, for $$$i=1,2,\dots,n$$$
Output

Print $$$n$$$ lines. The $$$i$$$-th line should contain the potential of the $$$i$$$-th fish tank.

ExampleInput
4
123 20000 5 998244353
Output
738
40000
25
46917484591

加入题单

上一题 下一题 算法标签: