Five Minute PuzzleNumber Theory Level 2
Later that night, one of the friends came and divided the mangoes into three equal piles and took one of the piles. Then the second friend came and divided the remaining mangoes into three piles but observed there was one mango left over so he took one one pile and the remaining extra mango. Finally, the last friend came and took all the remaining mangoes.
In the morning, each friend told the others how many mangoes he had. Surprisingly, they all had the same number of mangoes. So, how many total mangoes did they collect?