Eliška was placing cakes into boxes, from which she then built a pyramid as shown in the picture. Each box in a higher row contained as many cakes as the two adjacent boxes below it combined. In the three boxes marked with stars, there were three, five, and six cakes.

![](https://cdn.mathpix.com/cropped/2024_04_17_2593db36155ed0011264g-2.jpg?height=326&width=640&top_left_y=1302&top_left_x=708)

Eliška noticed that if she were to swap the marked boxes (and adjust the number of cakes in the other boxes according to the previous rule), the total number of cakes would not be less.

How many cakes were in the marked box in the second row from the bottom?

(L. Hozová)
Let's denote the number of cakes in the lower row of the pyramid as $a, b, c, d$, and from there, we can express the numbers in the other boxes:

![](https://cdn.mathpix.com/cropped/2024_04_17_2593db36155ed0011264g-2.jpg?height=326&width=1250&top_left_y=2047&top_left_x=403)

The sum of all the given numbers is

$$
4 a + 9 b + 9 c + 4 d = 4(a + d) + 9(b + c)
$$

The numbers in the boxes marked with stars are $a, d$, and $b+c$, which are (in some order) the numbers 3, 5, and 6. The total sum is the smallest possible when the number $b+c$ (which contributes the most to the sum) is the smallest possible, i.e., 3.

There were three cakes in the marked box in the second row from the bottom.

Note. The problem can also be solved by examining all possible distributions of the known numbers of cakes. Given the evident symmetries, it suffices to consider three cases:

- $a=3, d=5, b+c=6$, which gives a total sum of 86,
- $a=3, d=6, b+c=5$, which gives a total sum of 81,
- $a=5, d=6, b+c=3$, which gives a total sum of 71.

The smallest sum occurs in the third case, which agrees with the previous conclusions.

Evaluation. 3 points for the general completion of the pyramid, or for the analysis of possibilities; 3 points for solving the problem.