Excel in Energy Storage with Optimal Battery Costs and Durations