Compute the sum of a geometric series from first term, ratio and term count.
输入首项 a、公比 r 与项数 n,求前 n 项和。