Recipes

No attempts yetTime limit1sMemory limit128 MB

Problem

A little-known fact about Richard Stallman is that he loves to share not only his source code, but also his recipes. Because of this, he often needs to scale a recipe up to feed a few extra programmers: he multiplies the amount of every ingredient by some constant factor. Doing this by hand has grown tedious, and the fractions involved lead to mistakes. Hungry programmers get grumpy when the food turns out badly, and they start losing focus and breaking the build. Your task is to prevent all of that by writing a program that converts recipes automatically.

Input

The first line contains the number $K$ of data sets. The $K$ data sets follow, each describing one recipe in the format below.

The first line of a recipe contains two integers $I$ and $C$: the number of ingredients and the constant factor to multiply by. The next $I$ lines each describe one ingredient with three integers $w$, $n$, and $d$, giving the amount used in the original recipe.

  • $w$ is the number of whole units. For flour, $w = 2$ means 2 cups.
  • $n$ and $d$ give the fractional part. For flour, $n = 1$ and $d = 4$ means an extra $1/4$ cup.

On each ingredient line, $w$ and $n$ are separated by whitespace, while $n$ and $d$ are separated by a single slash (written as n/d). The denominator $d$ is always one of $1$, $2$, $3$, $4$, or $8$.

Output

For each data set, print a line Data Set x: on its own, where $x$ is the data set number, starting from $1$. On the following $I$ lines, print the scaled amount of each ingredient.

  • If the result has no fractional part, print it as a single integer.
  • Otherwise, print it in reduced form as whole n/d, with the whole part separated from the fraction by a single space (the whole part may be $0$).

Separate consecutive data sets with a blank line.