{"raw_statement":[{"iden":"statement","content":"Since the problem set was hard, here is an easy task for you to solve.\n\nYou are given an array a consisting of n integers, and your task is to calculate the summation of the multiplication of all subsets of array a. (See the note for more clarifications)\n\nA subset of an array a is defined as a set of elements that can be obtained by deleting zero or more elements from the original array a.\n\nThe first line contains an integer T, where T is the number of test cases.\n\nThe first line of each test case contains an integer n (1 ≤ n ≤ 105), where n is the size of array a.\n\nThe second line of each test case contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106), giving the array a.\n\nFor each test case, print a single line containing the summation of the multiplication of all subsets of array a. Since this number may be too large, print the answer modulo 109 + 7.\n\nAs input/output can reach huge size it is recommended to use fast input/output methods: for example, prefer to use _scanf/printf_ instead of _cin/cout_ in C++, prefer to use _BufferedReader/PrintWriter_ instead of _Scanner/System.out_ in Java.\n\nIn the first test case, the array a has 6 subsets, and the answer is calculated as follow: \n\n"},{"iden":"input","content":"The first line contains an integer T, where T is the number of test cases.The first line of each test case contains an integer n (1 ≤ n ≤ 105), where n is the size of array a.The second line of each test case contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106), giving the array a."},{"iden":"output","content":"For each test case, print a single line containing the summation of the multiplication of all subsets of array a. Since this number may be too large, print the answer modulo 109 + 7."},{"iden":"note","content":"As input/output can reach huge size it is recommended to use fast input/output methods: for example, prefer to use _scanf/printf_ instead of _cin/cout_ in C++, prefer to use _BufferedReader/PrintWriter_ instead of _Scanner/System.out_ in Java.In the first test case, the array a has 6 subsets, and the answer is calculated as follow: (1) + (2) + (3) + (1 × 2) + (1 × 3) + (2 × 3) + (1 × 2 × 3) = 23."}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ T \\in \\mathbb{Z} $ be the number of test cases.  \nFor each test case $ k \\in \\{1, \\dots, T\\} $:  \n- Let $ n_k \\in \\mathbb{Z} $ denote the size of the array.  \n- Let $ A_k = (a_{k,1}, a_{k,2}, \\dots, a_{k,n_k}) $ be a sequence of positive integers.  \n\n**Constraints**  \n1. $ 1 \\le T \\le 10^5 $  \n2. For each $ k \\in \\{1, \\dots, T\\} $:  \n   - $ 1 \\le n_k \\le 10^5 $  \n   - $ 1 \\le a_{k,i} \\le 10^6 $ for all $ i \\in \\{1, \\dots, n_k\\} $  \n\n**Objective**  \nFor each test case $ k $, compute:  \n$$\nS_k = \\sum_{\\substack{S \\subseteq A_k \\\\ S \\neq \\emptyset}} \\prod_{x \\in S} x \\mod (10^9 + 7)\n$$  \nThat is, the sum of the products of all non-empty subsets of $ A_k $.","simple_statement":"Given an array of n integers, find the sum of the products of all possible non-empty subsets. Return the result modulo 10^9 + 7.","has_page_source":false}