Sahih Muslim, Book 23, Hadith 2 (Muslim 4103)

Ibn Abbas (Allah be pleased with them) reported Allah's Messenger (ﷺ) as saying:

Give the shares to those who are entitled to them, and what remains over goes to the nearest male heir.