Given the first 2 terms A1 and A2 of an Arithmetic Series.Find the N^{th} term of the series. 
Example 1:
Input:
A1=2
A2=3
N=4
Output:
5
Explanation:
The series is 2,3,4,5,6....
Thus,4th term is 5.
Example 2:
Input:
A1=1
A2=2
N=10
Output:
10
Explanation:
The series is1,2,3,4,5,6,7,8,9,10,11..
Thus,10th term is 10.
Your Task:
You don't need to read input or print anything.Your Task is to complete the function nthTermOfAP() which takes three integers A1,A2 and N as input parameters and returns the nth term of the AP that has A1 and A2 as the first and second terms respectively.
Expected Time Complexity:O(1)
Expected Auxillary Space:O(1)
Constraints:
-10^{4}<=A1,A2<=10^{4}
1<=N<=10^{3}

Difficulty: EASY
Tags: Mathematics
Expected Time Complexity: O(1)
Expected Auxiliary Space: O(1)

Starter code:
#User function Template for python3

class Solution:
    def nthTermOfAP(self,A1,A2,N):
        #code here

Solutions:
class Solution:

	def nthTermOfAP(self, A1, A2, N):
		return A1 + (N - 1) * (A2 - A1)


class Solution:

	def nthTermOfAP(self, A1, A2, N):
		dif = A2 - A1
		num = A1
		for i in range(1, N):
			num += dif
		return num


class Solution:

	def nthTermOfAP(self, A1, A2, N):
		l = []
		d = A2 - A1
		l.append(A1)
		for i in range(1, N + 1):
			l.append(l[i - 1] + d)
		return l[N - 1]


class Solution:

	def nthTermOfAP(self, A1, A2, N):
		D = A2 - A1
		nth = A1 + (N - 1) * D
		return nth


class Solution:

	def nthTermOfAP(self, A1, A2, N):
		n = A1
		d = A2 - A1
		for i in range(N - 1):
			n = n + d
		return n


class Solution:

	def nthTermOfAP(self, A1, A2, N):
		d = A2 - A1
		An = A1 + (N - 1) * d
		return An


class Solution:

	def nthTermOfAP(self, A1, A2, N):
		common_difference = A2 - A1
		x = A1
		for i in range(N - 1):
			x = x + common_difference
		return x


class Solution:

	def nthTermOfAP(self, A1, A2, N):
		diff = A2 - A1
		ans = A1 + (N - 1) * diff
		return ans


class Solution:

	def nthTermOfAP(self, a1, a2, n):
		d = a2 - a1
		r = a1 + d * (n - 1)
		return r


class Solution:

	def nthTermOfAP(self, A1, A2, N):
		series = [A1, A2]
		a = A2 - A1
		An = A2
		for i in range(N):
			An = An + a
			series.append(An)
		return series[N - 1]


class Solution:

	def nthTermOfAP(self, A1, A2, N):
		d = A2 - A1
		nth_term = A1 + (N - 1) * d
		return nth_term


class Solution:

	def nthTermOfAP(self, A1, A2, N):
		d = A2 - A1
		l1 = [A1, A2]
		if N <= 2:
			return l1[N - 1]
		else:
			for i in range(N - 2):
				a = l1[-1] + d
				l1.append(a)
			return l1[-1]


class Solution:

	def nthTermOfAP(self, A1, A2, N):
		list1 = []
		term = A1 + (N - 1) * (A2 - A1)
		return term


class Solution:

	def nthTermOfAP(self, A1, A2, N):
		d = A2 - A1
		num = A1 + d * (N - 1)
		return num


class Solution:

	def nthTermOfAP(self, A1, A2, N):
		x = A2 - A1
		nthterm = A1 + (N - 1) * x
		return nthterm


class Solution:

	def nthTermOfAP(self, A1, A2, N):
		diff = A2 - A1
		nth_term = A1 + (N - 1) * diff
		return nth_term


class Solution:

	def nthTermOfAP(self, A1, A2, N):
		sum = A1
		diff = A2 - A1
		for i in range(1, N):
			sum += diff
		return sum


class Solution:

	def nthTermOfAP(self, A1, A2, N):
		diff = A2 - A1
		return A1 + N * diff - diff


class Solution:

	def nthTermOfAP(self, A1, A2, N):
		d = A2 - A1
		an = A1 + (N - 1) * d
		return an


class Solution:

	def nthTermOfAP(self, A1, A2, N):
		d = A2 - A1
		AN = A1 + (N - 1) * d
		return AN


class Solution:

	def nthTermOfAP(self, A1, A2, N):
		a = A1
		d = A2 - A1
		res = a + (N - 1) * d
		return res


class Solution:

	def nthTermOfAP(self, A1, A2, N):
		a = N - 1
		b = A2 - A1
		c = A1 + a * b
		return c


class Solution:

	def nthTermOfAP(self, A1, A2, N):
		d = A2 - A1
		return A2 + d * (N - 2)


class Solution:

	def nthTermOfAP(self, a, b, n):
		d = b - a
		p = a + (n - 1) * d
		return p


class Solution:

	def nthTermOfAP(self, A1, A2, N):
		d = A2 - A1
		ap = A1 + (N - 1) * d
		return ap


class Solution:

	def nthTermOfAP(self, A1, A2, N):
		if N == 1:
			return A1
		if N == 2:
			return A2
		else:
			if A2 > A1:
				dif = A2 - A1
				for i in range(0, N - 1):
					A1 = A1 + dif
				return A1
			if A1 > A2:
				dif = A1 - A2
				for i in range(0, N - 1):
					A1 = A1 - dif
				return A1


class Solution:

	def nthTermOfAP(self, A1, A2, N):
		d = A2 - A1
		n = A1 + (N - 1) * d
		return n


class Solution:

	def nthTermOfAP(self, A1, A2, N):
		ap_list = []
		ap_list.append(A1)
		ap_list.append(A2)
		k = A2 - A1
		last_term = A2
		for i in range(3, N + 1):
			last_term = last_term + k
			ap_list.append(last_term)
		return ap_list[N - 1]


class Solution:

	def nthTermOfAP(self, A1, A2, N):
		lastnumber = A1
		new = []
		while N > 0:
			difference = A2 - A1
			new.append(lastnumber)
			lastnumber = lastnumber + difference
			N = N - 1
		return new[N - 1]


class Solution:

	def nthTermOfAP(self, A1, A2, N):
		a = A1
		b = A2 - A1
		for i in range(N - 1):
			a = a + b
		return a


import math

class Solution:

	def nthTermOfAP(self, A1, A2, N):
		d = A2 - A1
		return A1 + (N - 1) * d


class Solution:

	def nthTermOfAP(self, A1, A2, N):
		d = A2 - A1
		fn = d * (N - 1) + A1
		return fn


class Solution:

	def nthTermOfAP(self, A1, A2, N):
		d = A2 - A1
		c = A1 + (N - 1) * d
		return c


class Solution:

	def nthTermOfAP(self, A1, A2, N):
		d = A2 - A1
		t2 = N - 1
		t1 = t2 * d
		ans = A1 + t1
		return ans


class Solution:

	def nthTermOfAP(self, A1, A2, N):
		d = A2 - A1
		nterm = A1 + (N - 1) * d
		return nterm


class Solution:

	def nthTermOfAP(self, A1, A2, N):
		d = A2 - A1
		nth = A1 + (N - 1) * d
		return nth


class Solution:

	def nthTermOfAP(self, A1, A2, N):
		difference = A2 - A1
		nthTerm = A1 + (N - 1) * difference
		return nthTerm