Davis has a number of staircases in his house and he likes to climb each staircase , , or steps at a time. Being a very precocious child, he wonders how many ways there are to reach the top of the staircase.
Given the respective heights for each of the staircases in his house, find and print the number of ways he can climb each staircase, module on a new line.
The staircase has steps. Davis can step on the following sequences of steps:
There are possible ways he can take these steps and
Complete the stepPerms function using recursion in the editor below.
stepPerms has the following parameter(s):
int n: the number of stairs in the staircase
int: the number of ways Davis can climb the staircase, modulo 10000000007
The first line contains a single integer, , the number of staircases in his house.
Each of the following lines contains a single integer, , the height of staircase .
for of the maximum score.
3 s = 3 (number of staircases)
1 first staircase n = 1
3 second n = 3
7 third n = 7
Let's calculate the number of ways of climbing the first two of the Davis' staircases:
The first staircase only has step, so there is only one way for him to climb it (i.e., by jumping step). Thus, we print on a new line.
The second staircase has steps and he can climb it in any of the four following ways: