# Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

# Jimmy and Jamy

By zobayer · Limits 1s, 512 MB

Jimmy and Jamy are two brothers. They like to play with colored marble.

Jimmy has N boxes with three different colors (red, green, and blue) marble. Each box contains one or more red, green, and blue color marble.

Now Jimmy randomly selects a colored marble and asked his brother (Jamy) what is the probability that it comes from “I” box, where “I” means the index number of the given box.

Jamy is a lazy boy and he is unable to respond to his brother (Jimmy).

## Input

Input starts with an integer T (≤ 100), denoting the number of test cases.

Each case start with an integer N (1<=N<=100), S and I (1<=I<=N) where N denoting the number of box and S is a character string (“red” or “green” or “blue”) and I is the index number of selected box.

Next, N lines contain three integer R (1<=R<100), G (1<=G<=100), and B (1<=B<=100) where R, G, B denoting the number of color marbles.

## Output

For each test case, print a line in the format, "Case T: P", where T is the case number and P is the probability of Jamy tasks and rounded to five places after the decimal point.

## Sample

InputOutput
1
2 red 1
1 3 3
2 3 4

Case 1: 0.39130


### Statistics

80% Solution Ratio

Rakib.862542Earliest, 4w ago

MR.Jukerburg11Fastest, 0.0s

Rakib.862542Lightest, 131 kB

Rakib.862542Shortest, 1542B

### Submit 