2. In the bay, there are three pirate ships. During the night, raids occur, and on the first night, a third of the gold coins from the first ship are thrown onto the second ship. On the second night, a quarter of the gold coins from the second ship are thrown onto the third ship, and on the third night, a fifth of the gold coins from the third ship are thrown onto the first ship. In the morning after the third raid, each ship has exactly 360 gold coins. How many gold coins were on the first ship before the first raid?
## Solution.

After all three raids, each ship had 360 gold coins.

|  | First ship | Second ship | Third ship |
| :--- | :---: | :---: | :---: |
| After three raids | 360 | 360 | 360 |

Since one-fifth of the gold coins from the third ship were transferred to the first ship on the third night, four-fifths of the gold coins remained on the third ship, which amounted to 360 gold coins. If 360 gold coins represent four-fifths of the gold coins on the third ship, then one-fifth of the gold coins on the third ship is 90 gold coins. Before this transfer, there were $360+90=450$ gold coins on the third ship, and $360-90=270$ gold coins on the first ship.

|  | First ship | Second ship | Third ship |
| :--- | :---: | :---: | :---: |
| Before the third raid | 270 | 360 | 450 |

Since one-fourth of the gold coins from the second ship were transferred to the third ship on the second night, there were $360+360: 3=3 \cdot 120+120=4 \cdot 120=480$ gold coins on the second ship before this. On the third ship, there were $450-120=330$ gold coins before this.

|  | First ship | Second ship | Third ship |
| :--- | :---: | :---: | :---: |
| Before the second raid | 270 | 480 | 330 |

Since one-third of the gold coins from the first ship were transferred to the second ship on the first night, there were $270+270: 2=2 \cdot 135+135=3 \cdot 135=405$ gold coins on the first ship before this. On the second ship, there were $480-135=345$ gold coins before this.

|  | First ship | Second ship | Third ship |
| :--- | :---: | :---: | :---: |
| Before the first raid | 405 | 345 | 330 |

Before the first raid, there were 405 gold coins on the first ship.