A certain number of thieves steal a certain number of gold coins. Tired after their theft, they decide to sleep on it, and divide the money in the morning. However, they don't trust each other. So the first thief wakes up and divides the money into exactly as many shares as there are thieves, but there is one extra coin left over. He takes one share and the extra coin! All through the night, each thief wakes up in turn and does the same thing: divides the money into exactly as many shares as there are thieves with one coin left over and takes one share and the extra coin. In the morning when they all wake up, the money divides perfectly amongst the thieves. How much money was there?
To know how many gold coins there were: