staircase

Jack and Jill are sitting at the bottom of their tree house and debating in how many ways then can jump up the stairs on the tree and reach the tree house .Because Jack is older than Jill, He can jump one, two or three stairs in one step while Jill can jump just one or two stairs in one step .
For example, Jack can cover the 8 stairs by jumping (2,2,2,2) or (2,1,2,1,2) or other suitable combinations of steps.
Could you help them to find the total number of possibilities they have to reach the top.
Note that the order of the steps is important here, for example, (3,1) is treated distinct from (1,3)  i. e. jumping 3 stairs in first step followed by jumping 1 stair in other step is different from jumping one stair in first step and 3 stairs in second step.
Write a program to help them out 
Input:
 The number of stairs to be covered.
Output:
Number of total ways to reach to the top for Jack in the first line and Number of total ways to reach at the top for Jill in the second line.
(For other cases, output is ERROR)
Note: if total stairs to be covered are 3
Then, 
For jack total combinations are 4

1 1 1

1 2

2 1

3

For Jill total combinations are 3

1 1 1 

1 2

2 1

SAMPLE INPUT
3

SAMPLE OUTPUT
Jack-4
Jill-3

Source: hackerearth | Difficulty: EASY


Solutions:
trib = []
def calc_trib(n):
	trib.append(0)
	trib.append(1)
	trib.append(2)
	trib.append(4)
	for i in range(4,n+1):
		temp = (trib[i-1] + trib[i-2] + trib[i-3])
		trib.append(temp)

fib = []
def calc_fib(n):
	fib.append(0)
	fib.append(1)
	fib.append(2)
	for i in range(3,n+1):
		temp1=(fib[i-1]+fib[i-2])
		fib.append(temp1)

N=eval(input())
if N<=0:
	print('ERROR')
else:
	calc_trib(N)
	calc_fib(N)
	print(('Jack-'+str(trib[N])))
	print(('Jill-'+str(fib[N])))


a = 0; b = 1; c = 1; d = 0; e = 1;
n = int(input());
if n <= 0:
	print("ERROR");
else:
	n -= 1;
	while (n):
		c = a + b + c;
		b = c - a - b;
		a = c - b - a;
		e = d + e;
		d = e - d;
		n -= 1;
	e = d + e;
	d = e - d;
	print("Jack-"+str(c)+"\nJill-"+str(e));


i=eval(input())
def stairs1(n):
	if n<=0:
		return "ERROR"
	if n==1:
		return 1
	if n==2:
		return 2
	if n==3:
		return 4

	return stairs1(n-1)+stairs1(n-2)+stairs1(n-3)

def stairs2(n):
	if n<=0:
		return "ERROR"
	if n==1:
		return 1
	if n==2:
		return 2
	
	return stairs2(n-1)+stairs2(n-2)

ans=str(stairs1(i))
if ans=="ERROR":
	print(ans)
else:
	print("Jack-"+ans)

ans=str(stairs2(i))
if ans!="ERROR":
	print("Jill-"+ans)