Excessive Roth contribution

I contributed 7000 in non deductible Roth IRA contributions in 2024 before realizing I was beyond the MAGI, I reached out to Schwab so the best option for me is to withdraw the funds (with a Schwab Form) and also fill out the IRS 5329. 

 

 

 

How do I calculate the income on the 2024 contribution (and where do I enter this)? I found a fidelity calculator that makes sense but wasn't sure if this was universal: 

 

 

 

Contributions * ((account value before correction) - (account value before contribution + contributions))/ (account value before contribution + contributions)