Deuteronomy 4:29-31 NIV

29 But if from there you seek the LORD your God, you will find him if you seek him with all your heart and with all your soul.
30 When you are in distress and all these things have happened to you, then in later days you will return to the LORD your God and obey him.

References for Deuteronomy 4:30

31 For the LORD your God is a merciful God; he will not abandon or destroy you or forget the covenant with your ancestors, which he confirmed to them by oath.

References for Deuteronomy 4:31