145. Three friends had a monkey. They bought a certain number of mango fruits and hid them. At night, one of the friends wanted to indulge, went to the storeroom, and wanted to take a third of the fruits, but it turned out that one fruit was left over, and he gave it to the monkey, and ate his share. After some time, the second one came and, not suspecting that the first one had already taken his share, divided the remainder into three equal parts, and again one fruit was left over, and he gave it to the monkey and ate his share. Finally, the third one came and also divided the remainder into three equal parts, and again one fruit was left over, which he gave to the monkey, and ate his share.

The next morning, all three came to the storeroom and divided the remaining fruits equally among themselves, and again one fruit was left over, which they gave to the monkey.

Determine the smallest number of fruits that satisfies the above conditions of distribution.

![](https://cdn.mathpix.com/cropped/2024_05_21_926f0bb262c8f9569516g-029.jpg?height=268&width=394&top_left_y=1491&top_left_x=837)

![](https://cdn.mathpix.com/cropped/2024_05_21_926f0bb262c8f9569516g-030.jpg?height=297&width=1307&top_left_y=248&top_left_x=383)

## Problem from the tractate "Bava Batra".

Talmud.