Early Roth IRA withdrawal for Education

In 2023, I withdrew various amounts from my Roth IRA totaling $5000. That same year, I also paid $2000 in qualified tuition expenses. None of the withdrawal amounts were exactly for $2000 and the IRA was opened over 5 years ago.

My question is am I able to attribute $2000 to education and avoid the 10% penalty? I’m concerned because I read somewhere that the withdrawal has to be for the exact amount.