Compute the sum of a geometric series from first term, ratio and term count.
輸入首項 a、公比 r 與項數 n,求前 n 項和。