Calculate the sum of geometric series