def Pell(n): a=1 b=0 for k in range(1,n+1): u=a a=3*u+4*b b=2*u+3*b return a,b