{"raw_statement":[{"iden":"problem statement","content":"You are given a sequence of positive integers $A=(A_1,A_2,\\ldots,A_N)$.\nThere are $2^N$ subsequences of $A$ when distinguishing subsequences by the indices of their elements. Let $S_1, S_2, \\ldots, S_{2^N}$ be the sums of these subsequences, enumerated **in ascending order**.\nFor all integers $k$ ($1\\leq k\\leq 2^N-1$) that satisfy $1.01 \\times S_k\\leq S_{k+1}$, output $S_k, S_{k+1}, (k\\bmod 998244353)$.\nWhat is a subsequence A subsequence of a sequence $A$ is a sequence obtained by removing zero or more elements from $A$ and arranging the remaining elements in their original order."},{"iden":"constraints","content":"*   $2\\leq N\\leq 5000$\n*   $1\\leq A_i\\leq 10^{13}$"},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$N$\n$A_1$ $A_2$ $\\ldots$ $A_N$"},{"iden":"sample input 1","content":"3\n5 5 3"},{"iden":"sample output 1","content":"5\n0 3 1\n3 5 2\n5 8 4\n8 10 6\n10 13 7\n\nWe have the following eight subsequences:\n\n*   The empty subsequence. The sum is $0$.\n*   $(5)$. The sum is $5$. This subsequence appears twice.\n*   $(3)$. The sum is $3$.\n*   $(5,5)$. The sum is $10$.\n*   $(5,3)$. The sum is $8$. This subsequence appears twice.\n*   $(5,5,3)$. The sum is $13$.\n\n$S_1, S_2, \\ldots, S_8$ are $0,3,5,5,8,8,10,13$ in order."},{"iden":"sample input 2","content":"2\n100 101"},{"iden":"sample output 2","content":"3\n0 100 1\n100 101 2\n101 201 3"},{"iden":"sample input 3","content":"2\n101 102"},{"iden":"sample output 3","content":"2\n0 101 1\n102 203 3"},{"iden":"sample input 4","content":"20\n456 206 448 830 937 793 483 527 772 239 361 925 364 956 355 420 557 739 323 912"},{"iden":"sample output 4","content":"23\n0 206 1\n206 239 2\n239 323 3\n323 355 4\n355 361 5\n364 420 7\n420 445 8\n448 456 10\n456 483 11\n483 527 12\n529 557 14\n570 594 19\n594 600 20\n603 626 22\n626 654 23\n662 678 26\n695 716 32\n725 733 36\n743 763 39\n784 793 48\n820 830 60\n850 865 65\n11397 11603 1048575"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}