Psalm 119:71

71 My suffering was good for me, because through it I learned your statutes.