Psalms 119:67,71

67 Before I was afflicted, I went astray;  But now I observe your word.

71 It is good for me that I have been afflicted,  That I may learn your statutes.