sum of ap formula