#K77042. Fibonacci Tree Branch Thickness

    ID: 34776 Type: Default 1000ms 256MiB

Fibonacci Tree Branch Thickness

Fibonacci Tree Branch Thickness

In this problem, you are given the thickness of the first two branches of a Fibonacci Tree and an integer N. The thickness of every subsequent branch is the sum of the thicknesses of the two preceding branches, forming a Fibonacci-like sequence. Formally, the branch thickness ( t(n) ) is defined as follows:

( t(1) = T1 )
( t(2) = T2 )
( t(n) = t(n-1) + t(n-2) ) for ( n \geq 3 )

Your task is to compute the thickness of the Nth branch. This problem tests your ability to implement iterative (or recursive) algorithms efficiently.

inputFormat

The input consists of three space-separated integers: T1, T2, and N, where T1 and T2 represent the thickness of the first and second branches respectively, and N (N (\ge 1)) is the branch index whose thickness must be computed.

outputFormat

Output a single integer representing the thickness of the Nth branch.## sample

1 1 5
5

</p>