殚精极虑

dān jīng jí lǜ

to exhaust one's thoughts and ingenuity (idiom); to think sth through thoroughly

to rack one's brains; to leave no stone unturned

殚

dān

entirely

精

jīng

essence

极

jí

extremely

虑

lǜ

to think over