#C404. Mystical Tree Fruits
Mystical Tree Fruits
Mystical Tree Fruits
You are given a mystical tree whose fruits grow in a peculiar way. On the first day, the tree bears F1 fruits, and on the second day, it bears F2 fruits. From the third day onward, the number of fruits produced on day D follows the recurrence relation:
\(F_D = F_{D-1} + F_{D-2}\)
Your task is to determine the number of fruits on the tree after D days.
Note: For each test case, given three integers D, F1, and F2, output the total number of fruits on the tree after day D.
inputFormat
The first line contains an integer T, the number of test cases. Each of the following T lines contains three space-separated integers: D (the day number), F1 (the number of fruits on the first day), and F2 (the number of fruits on the second day).
outputFormat
For each test case, print a single integer on a new line representing the total number of fruits on the tree after D days.
## sample3
5 2 3
10 1 1
3 1 2
13
55
3
</p>