#P2415. 集合求和

集合求和

Description

Given a set ss (the number of elements 30\le 30), compute the sum of elements over all subsets of this set.

Input Format

The elements in the set (each element 1000\le 1000).

Output Format

The sum of elements over all subsets of ss.

2 3

10

Hint

[Sample Explanation]

The subsets are: ,{2},{3},{2,3}\varnothing, \{ 2 \}, \{ 3 \}, \{ 2, 3 \}, and the total is 2+3+2+3=102 + 3 + 2 + 3 = 10.


[Constraints]

For 100%100\% of the testdata, 1s301 \le \lvert s \rvert \le 30, 1si10001 \le s_i \le 1000, and the sum of elements over all subsets of ss is 1018\le {10}^{18}.

Translated by ChatGPT 5