Information Theory is one of the most popular courses in Marjar University. In this course, there is an important chapter about information entropy.

Entropy is the average amount of information contained in each message received. Here, a message stands for an event, or a sample or a character drawn from a distribution or a data stream. Entropy thus characterizes our uncertainty about our source of information. The source is also characterized by the probability distribution of the samples drawn from it. The idea here is that the less likely an event is, the more information it provides when it occurs.

Generally, "entropy" stands for "disorder" or uncertainty. The entropy we talk about here was introduced by Claude E. Shannon in his 1948 paper "A Mathematical Theory of Communication". We also call it Shannon entropy or information entropy to distinguish from other occurrences of the term, which appears in various parts of physics in different forms.

Named after Boltzmann's H-theorem, Shannon defined the entropy Η (Greek letter Η, η) of a discrete random variable `X` with possible values `{x _{1}, x_{2}, ..., x_{n}}` and probability mass function

$$\Large H(X)=E(-\ln(P(x)))$$

Here E is the expected value operator. When taken from a finite sample, the entropy can explicitly be written as

$$\Large H(X)=-\sum_{i=1}^{n}P(x_i)\log_{~b}(P(x_i))$$

Where `b` is the base of the logarithm used. Common values of b are 2, Euler's number `e`, and 10. The unit of entropy is *bit* for `b` = 2, *nat* for `b` = `e`, and *dit* (or digit) for `b` = 10 respectively.

In the case of `P(x _{i})` = 0 for some

Your task is to calculate the entropy of a finite sample with `N` values.

There are multiple test cases. The first line of input contains an integer `T` indicating the number of test cases. For each test case:

The first line contains an integer `N` (1 <= `N` <= 100) and a string `S`. The string `S` is one of "bit", "nat" or "dit", indicating the unit of entropy.

In the next line, there are `N` non-negative integers `P _{1}`,

提交代码