Arithmetic Sequence Term

An arithmetic sequence is a row of numbers where each next value changes by the same fixed step. Write nth_term, which takes the first term a, the common difference d, and the position n. Return the n-th term of the sequence, where the first term has position 1.

Примеры

Ввод
1, 2, 3
Вывод
5
Ввод
1, 2, 4
Вывод
7
Ввод
5, 3, 1
Вывод
5

Нужно реализовать

def nth_term(a: int, d: int, n: int) -> int:

Теги

math
PostgreSQLv16

Tutaj pojawi się wynik wykonania kodu

Visible tests
1
Input
1, 2, 3
Expected5
2
Input
1, 2, 4
Expected7
3
Input
5, 3, 1
Expected5
4
Input
0, 0, 10
Expected0
5
Input
2, -1, 5
Expected-2
6
Input
10, -1, 5
Expected6
Focus radio
Paused · SomaFM · Fluid