Bessie and Canmuu have found a sack containing (1 \leq N \leq 250) gold coins that they wish to divide as evenly as possible. Coin has value v_i (1 \leq v_i \leq 2000). The cows want to split the pile as evenly as possible, but that is not always feasible. What is the smallest possible difference between the values of the two piles?
In addition, Bessie and Canmuu have found that there might be multiple ways to split the coins to achieve this minimum difference. They would also like to know the number of ways to split the coins as fairly as possible. If it is not possible to split the piles evenly, Bessie will get the pile with the higher value.
For example, consider five coins with values , , , , and . They split the coins into two piles: one with the coin worth , and the other with the rest (1+2+4+8=15). The difference is 16-15=1. This is the only way to split the coins with this difference, so the number of optimal ways is 1.
Note that coins of equal value can be interchanged between piles, increasing the number of optimal ways. For instance, the set of coins \{1, 1, 1, 1\} can be split in six ways into two optimal partitions, each with two coins.
The first line contains a single integer .
The next lines each contain a single integer v_i.
The first line should contain a single integer: the smallest possible difference between the values of the two piles.
The second line should contain a single integer: the number of ways to split the coins with the minimum difference (as printed on the first line). Since this number can be large, print the result modulo .
Ejemplo 1