This problem is a harder variation of A tale of The Rich Arab Man, which - though phrased very similarly - needs a different method to solve.
A very rich pearl harvester had four wives. His first wife had four kids, the second wife had three kids, third wife had two kids and the last young wife had a single kid.
One day he decided to give away all his pearls to his wives.
He carried all those pearls in a huge bag and entered the house of his first wife. Upon arrival, the four kids quickly picked one pearl for each of them from the bag and ran away. Then he told his intention to his wife. She counted and took for herself a quarter of the pearls in the bag and returned the remainders to him to be shared with the other ladies.
He carried the bag and entered the house of his second wife. Quickly three kids jumped in and get away with a pearl for each of them. After that, knowing the man's intention, his second wife took a quarter of the pearls and returned the balance to be shared with the other ladies.
He then went to the third wife. Two kids grabbed a pearl for each of them and went missing. After that, the lady of the house took a quarter of the pearls and gave the balance to him.
When he walked into the last wife, he gave a pearl to the single kid in that house. The lady took the quarter of what left in that bag.
When he walk out from that house, the pearl harvester found the remaining quantity of the pearls was exactly divisible by four. Then he divided the pearls into four equal numbers and gave away to each wife separately.
What was the initial number of pearls in the bag carried by him.?