Math, asked by Kumari6015, 1 year ago

shashank is a newbie to mathematics and he is very excited after knowing that a given l of cardinality n has (2n - 1) non-empty sublist. he writes down all the non-empty sublists for a given set a. for each sublist he calculates sublist_sum which is the sum of elements and denotes them by s1 s2 s3 ... s(2n-1). he then defines a special_sum p. p = 2s1 + 2s2 + 2s3 .... + 2s(2n-1) and reports p % (109 + 7).

Answers

Answered by Anonymous
0
INPUT FORMAT:

✔️The first line contains an integer N, i.e., the size of list A. 
The next line will contain N integers, each representing an element of list A.

------------------------------

OUTPUT FORMAT:

✔️Print special_sum, P modulo (109 + 7).

------------------------------

CONSTRAINTS:

✔️1 ≤ N ≤ 105 
0 ≤ ai ≤ 1010 , where i ∈ [1 .. N]
------------------------------

SAMPLE INPUT:

3
1 1 2
------------------------------

SAMPLE OUTPUT:

44
------------------------------

EXPLANATION:

✔️For given list, sublist and calculations are given below:-

1. {1} and 21 = 2 
2. {1} and 21 = 2 
3. {2} and 22 = 4 
4. {1,1} and 22 = 4 
5. {1,2} and 23 = 8 
6. {1,2} and 23 = 8 
7. {1,1,2} and 24 = 16 

✔️So total sum will be 44.
Similar questions