Please, try EDU on Codeforces! New educational section with videos, subtitles, texts, and problems.
×

The following languages are only available languages for the problems from the contest

Kotlin Heroes: Episode 4:

- Kotlin 1.3.70

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

A. Color Revolution

time limit per test

1 secondmemory limit per test

256 megabytesinput

standard inputoutput

standard outputHmm, how long has it been since the last color revolution? 5 years?! It's totally the time to make a new one!

So the general idea is the following. Division $$$1$$$ should have $$$n_1$$$ participants. Division $$$2$$$ should have $$$n_2$$$ and be exactly $$$k$$$ times bigger than division $$$1$$$ ($$$n_2 = k \cdot n_1$$$). Division $$$3$$$ should have $$$n_3 = k \cdot n_2$$$ participants. Finally, division $$$4$$$ should have $$$n_4 = k \cdot n_3$$$ participants.

There are $$$n$$$ participants on Codeforces in total. So $$$n_1 + n_2 + n_3 + n_4$$$ should be exactly equal to $$$n$$$.

You know the values of $$$n$$$ and $$$k$$$. You also know that $$$n$$$ and $$$k$$$ are chosen in such a way that there exist values $$$n_1, n_2, n_3$$$ and $$$n_4$$$ such that all the conditions are satisfied.

What will be the number of participants in each division ($$$n_1, n_2, n_3$$$ and $$$n_4$$$) after the revolution?

Input

The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases.

Each of the next $$$t$$$ lines contains two integers $$$n$$$ and $$$k$$$ ($$$4 \le n \le 10^9$$$; $$$1 \le k \le 500$$$) — the total number of participants on Codeforces and the size multiplier for the corresponding testcase. In each testcase, $$$n$$$ and $$$k$$$ are chosen in such a way that the answer exists.

Output

For each testcase print four integers $$$n_1, n_2, n_3$$$ and $$$n_4$$$ such that $$$n_2 = k \cdot n_1$$$, $$$n_3 = k \cdot n_2$$$, $$$n_4 = k \cdot n_3$$$ and $$$n_1 + n_2 + n_3 + n_4 = n$$$.

Example

Input

4 40 3 1200 7 320802005 400 4 1

Output

1 3 9 27 3 21 147 1029 5 2000 800000 320000000 1 1 1 1

Codeforces (c) Copyright 2010-2020 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Jul/10/2020 16:52:58 (i3).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|