There are four currencies in Byteland. These are: denary, frank, grosz and taler. They are not convertible (i.e. one cannot exchange one currency into another) and this is a serious disadvantage for the inhabitants of Byteland. The Byteland Bank of Business (short BBB), due to mistake between currencies, has faced the view of bankruptcy. It had made several contracts on giving credits. All of the contracts are of the following form:
Write a program which:
In the first line of the standard input there is written one positive integer
equal to the number of clients,
. The clients are numbered from
to
. In each of the following
lines there are written eight nonnegative integers. In the
-th line (
) there are written integers
, (
, for
). Integers
and
denote respectively credit limit and current credit of client number
in: denars (
), francs (
), groszes (
) and talers (
).
Your program should write in the first and only line of the standard output four nonnegative integers separated by single spaces. They should denote the minimal amounts of money BBB needs in denars, francs, groszes and talers respectively.
For the input data:
4 3 2 1 2 0 2 0 1 2 4 1 8 1 2 1 1 3 2 0 3 1 0 0 1 3 0 1 2 1 0 0 1
the correct result is:
1 2 0 7
or:
2 0 1 4
Task author: Marcin Kubica.
W razie problemów technicznych ze Szkopułem, prosimy o kontakt mailowy pod adresem szkopul@fri.edu.pl.
Jeśli chciałbyś porozmawiać o zadaniach, rozwiązaniach lub problemach technicznych, odwiedź nasze serwery na Discordzie. Są one moderowane przez społeczność, ale członkowie zespołu wsparcia również aktywnie się tam udzielają.