"Ape alone... weak. Apes together... strong."
-Caesar
The Apes are gathering resources for the upcoming winter. This time, Caesar and others went gathering wood. To store the gatherings, Maurice - a wise ape, and Caesar's best friend - has devised a plan on how the resources should be distributed:
All the logs are to be divided into piles. After this, -th of the logs from the first pile are to be shifted into the second pile. Then, th of the logs in the second pile, after the first transfer, are to be shifted into the third pile. Next, th of the logs in the third pile, after the transfer from the second pile, are to be shifted to the fourth, etc...
Finally, from the -th pile, th of the logs in the -th pile, after the previous transfer, are to be shifted to the first pile. After that, each pile will have -amount of logs.
Caesar and Maurice agreed to divide the resources into piles.
If, before shifting, the amount of logs in piles 1, 2, and 3 combined is , how many logs were gathered?