#C2229. Triponacci Sequence Calculation
Triponacci Sequence Calculation
Triponacci Sequence Calculation
You are given two integers t and n. Your task is to compute the n-th term of a Triponacci sequence where the first three terms are initialized as:
\(T(0) = T(1) = T(2) = t\)
For all \(n \ge 3\), the sequence is defined by the recurrence:
\(T(n) = T(n-1) + T(n-2) + T(n-3)\)
For example, if \(t = 2\) and \(n = 3\), then \(T(3) = 2 + 2 + 2 = 6\).
Your program should read the input from stdin and output the result to stdout.
inputFormat
The input consists of a single line containing two space-separated integers: \(t\) and \(n\), where \(t\) is the initial term for the sequence and \(n\) is the index of the term you need to compute.
outputFormat
Output a single integer which is the value of the \(n\)-th term of the Triponacci sequence.
## sample2 0
2