Numbers of Interest
Tag(s):

## Basic Programming, Easy, Mathamatics, Mathematics

Problem
Editorial
Analytics

Harold always boasted about his prowess with numbers. So one day Reese challenged him to a problem. He gave Harold two numbers X and Y and asked him to find out the Nth number of the series which began with X numbers of Y’s and the following elements are equal to the sum of the last X numbers in the series. Help Harold find the Nth number of the series.

Input:
The first line contains a number T , number of test cases.
The next T lines each contain 3 integers X, Y and N separated by single space.

Output:
For each test case print the Nth number of the sequence.

Constraints:
1<=T<=10^6
0 < N <= 50
0 < X < 50
0 <= Y< 3

Problem statement in native language : http://hck.re/F91Yaz

SAMPLE INPUT
1
3 2 7

SAMPLE OUTPUT
34

Explanation

For X=3,Y=2 the series will be as follow:
2, 2, 2, 6, 10, 18, 34

Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: Bash, C, C++, C++14, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Julia, Kotlin, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Swift, Swift-4.1, TypeScript, Visual Basic

## CODE EDITOR

Initializing Code Editor...

## This Problem was Asked in Challenge Name

Japan National Programming Challenge

OTHER PROBLEMS OF THIS CHALLENGE
• Algorithms > Searching
• Algorithms > Dynamic Programming
• Math > Linear Algebra