And Rabbi Yehoshua ben Korchah said: a person should always hasten to a matter of mitzvah, for on account of the one night by which the firstborn preceded the younger, she preceded her by four generations in Israel - Obed, Jesse, David, and Solomon - whereas the younger [merited royal descent only] as late as Rehoboam, as it is said, "and his mother's name was Naamah the Ammonitess" (1 Kings 14:21).
One Night Early Bought Four Generations of Kings
Yalkut Shimoni on Torah 87:1
וְאָמַר רַבִּי יְהוֹשֻׁעַ בֶּן קָרְחָה, לְעוֹלָם יַקְדִּים אָדָם לִדְבַר מִצְוָה, שֶׁבִּשְׁבִיל לַיְלָה אֶחָד שֶׁקִּדַּמְתָּה בְּכִירָה לַצְּעִירָה, קִדַּמְתָּה אַרְבָּעָה דּוֹרוֹת בְּיִשְׂרָאֵל, עוֹבֵד, יִשַּׁי, דָּוִד, שְׁלֹמֹה, וְאִלּוּ צְעִירָה עַד רְחַבְעָם שֶׁנֶּאֱמַר (מלכים א יד, כא) "וְשֵׁם אִמּוֹ נַעֲמָה הָעַמּוֹנִית".