gopals-stairs
Source: hackerearth
Difficulty: EASY

Gopal is climbing the stairs. He can jump 1 or 2 or 3 steps at a time.
He wants to climb N steps. In how many ways can he reach the Nth step?
As the answer can be too large Output it modulo 10^9+7.

Input:
First line of the input contains an integer T denoting the number of test cases.
Then T lines follow each line containing an integer N.

Output:
Output the required answer in a new line for each test case.

Constraints:
1 ≤ N ≤ 10^5

Sample Input
2
3
4

Sample Output
4
7

Explanation:
Test case: 2
There 7 ways of reaching 4^th step in the stairs:-

1+1+1+1
1+1+2
1+2+1
2+1+1
1+3
3+1
2+2SAMPLE INPUT
2
3
4

SAMPLE OUTPUT
4
7


t = int(input())
x = []
x.append(0)
x.append(1)
x.append(2)
x.append(4)
for i in range(0,t):
	n = int(input())
	if len(x)<=n:
		for j in range(len(x),n+1):
			x.append(x[j-1]+x[j-2]+x[j-3])
	ans = x[n]%((10**9)+7)
	print(ans)
	


dp={1:1,2:2,3:4}
def ans(n):
	if n in dp:
		return dp[n]
	else:
		l=[]
		l.append(1)
		l.append(2)
		l.append(4)
		for i in range(4,n+1):
			if i not in dp:
				l.append(l[i-2]+l[i-3]+l[i-4])
				dp[i]=l[i-2]+l[i-3]+l[i-4]
			else:
				l.append(dp[i])
		dp[n]=l[n-1]
		return l[n-1]
tc=int(eval(input()))
while tc>0:
	n=int(eval(input()))
	a=ans(n)
	print((a%(1000000007)))
	tc=tc-1


test=int(input())

k=3
arr=[0]*(100001)
arr[0]=1
arr[1]=1
arr[2]=2
arr[3]=4
for i in range (0,test):
	num=int(input())
	if num>k:
		for j in range(k,num+1):
			arr[j]=arr[j-1]+arr[j-2]+arr[j-3]
		print(arr[num]%1000000007)
	else:
		print(arr[num]%1000000007)
	k=max(num,k)


li=[0,1,2,4,7]
mod=1000000007
for _ in range(int(input())):
	m=int(input())
	while len(li)-1<m:
		li.append(sum(li[-3:])%mod)
	print((li[m]))
	
	


a = [0,1,2,4]
for i in range(4,100005):
	a.append( (a[i-1]+a[i-2]+a[i-3]) % 1000000007)
t = eval(input())
for i in range(0,t):
	n = eval(input())
	print(a[n])


ans=[0]*100005

arr=[0]*100005
m=10**9+7
arr[0]=1;arr[1]=1;arr[2] = 2
ans[0]=1;ans[1]=1;ans[2] = 2
for i in range (3,100000+1):
	arr[i] = (arr[i-1]+arr[i-2]+arr[i-3])%m
	#ans.append(arr[i])
for _ in range(eval(input())):
	n=int(eval(input()))
	print(arr[n])


li = [0 for x in range(100001)]
li[1] = 1
li[2] = 2
li[3] = 4
for i in range(4,100001) :
	li[i] = (li[i-3]%1000000007+li[i-2]%1000000007+li[i-1]%1000000007)%1000000007
t = int(input())
for _ in range(t) :
	n = int(input())
	print(li[n])