殚精极虑

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

extremely

to think over