Commentary for Berakhot 107:6
חייב אדם לברך על הרעה כשם שמברך על הטובה שנאמר (דברים ו, ה) ואהבת את ה' אלהיך בכל לבבך וגו' בכל לבבך בשני יצריך ביצר טוב וביצר הרע ובכל נפשך אפילו הוא נוטל את נפשך ובכל מאדך בכל ממונך ד"א בכל מאדך בכל מדה ומדה שהוא מודד לך הוי מודה לו
A man is in duty bound to utter a benediction for the bad even as he utters one for the good ; as it is said, "And thou shalt love the Lord thy God with all thy heart, and with all thy soul, and with all thy might" (Deut. vi. 5) — "with all thy heart," i.e. with thy two impulses, with the good and the evil impulse ; "with all thy soul," i.e. even if He take thy soul; "with all thy might," i.e. with all thy wealth. Another explanation of "with all thy might [meodeka]" — with whatever measure [middah] He metes out to thee, do Thou return Him thanks [modeh].