Dane su tri kutije loptica

i

takve 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 three 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
Dane su tri kutije loptica \(K_1, K_2\) i \(K_3\) takve 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 2\)), 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 1\)), 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_3\) gornjim operacijama.\\
[/lang]
[lang=en]
We're given three boxes \(K_1, K_2\) and \(K_3\) 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 2\)), 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 1\)), 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_3\) using the operations above.
[/lang]