It is narrated from Sayyiduna Ibn Abbas (may Allah be pleased with him) that the Prophet (peace and blessings be upon him) said: "Give the wealth to those entitled to it; then whatever is left, give it to a male." In one narration it says: "Join the fixed shares to those entitled to them; whatever is left is for the nearest male."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الفرائض / 12371