Dano je četiri kutija loptica

i

tako da svaka sadrži točno jednu lopticu. Dozvoljene su sljedeće operacije:

Odredi najveći broj loptica koji je moguće postići u kutiji

gornjim operacijama.
We're given four boxes

and

such that each of them contains exactly one ball. The following operations are allowed:

Determine the largest obtainable number of balls in

using the operations above.
[lang=hr]
%0
Dano je četiri kutija loptica \(K_1, K_2, K_3\) i \(K_4\) tako da svaka sadrži točno jednu lopticu. Dozvoljene su sljedeće operacije:
\begin{itemize}
\item Biranje jedne neprazne kutije \(K_j\) (\(1 \leq j \leq 3\)), uzimanje jedne loptice iz odabrane kutije i stavljanje dvije loptice u kutiju \(K_{j+1}\);
\item Biranje jedne neprazne kutije \(K_j\) (\(1 \leq j \leq 2\)), uzimanje jedne loptice iz odabrane kutije i zamjena sadržaja kutija \(K_{j+1}\) i \(K_{j+2}\).
\end{itemize}
Odredi najveći broj loptica koji je moguće postići u kutiji \(K_4\) gornjim operacijama.\\
[/lang]
[lang=en]
We're given four boxes \(K_1, K_2, K_3\) and \(K_4\) such that each of them contains exactly one ball. The following operations are allowed:
\begin{itemize}
\item Choosing a non-empty box \(K_j\) (\(1 \leq j \leq 3\)), removing one ball from the selected box and adding two balls to \(K_{j+1}\);
\item Choosing a non-empty box \(K_j\) (\(1 \leq j \leq 2\)), removing one ball from the selected box and swapping the contents of the boxes \(K_{j+1}\) and \(K_{j+2}\).
\end{itemize}
Determine the largest obtainable number of balls in \(K_4\) using the operations above.
[/lang]