Calculating the Sum of Geometric Sequences