The Prophet ﷺ said, "Give the fixed shares of inheritance to those entitled to them, and whatever remains goes to the nearest male relative."Abd bin Humayd narrated to us, Abdul-Razzaq informed us, from Muamar, from Ibn Tawus, from his father, from Ibn Abbas, from the Prophet ﷺ, something similar.
حدثنا عبد الله بن عبد الرحمن أخبرنا مسلم بن إبراهيم حدثنا وهيب حدثنا ابن طاووس عن أبيه
عن النبي ﷺ قال ألحقوا الفرائض بأهلها فما بقي فهو لأولى رجل ذكر حدثنا عبد بن حميد أخبرنا عبد الرزاق عن معمر عن ابن طاووس عن أبيه عن ابن عباس عن النبي ﷺ نحوه
Agreed upon. Bukhari related it in the Book of Inheritance, chapter on the inheritance of a son's son when there is no son, no. 6735, from Muslim bin Ibrahim, and Muslim, no. 1615, from the hadith of Wahib with the same wording.