Compute the sum of an arithmetic series from term count and first and last terms.
输入项数 n、首项 a₁ 与末项 aₙ,求前 n 项和。