Finding the terms and sum of an AP