Energetics of two-ribbon solar flares