def u(n, U = None):
    if n == 0: return 1
    elif n == 1: return 2
    else:
        U = [None] * (n+1)
        U[0], U[1] = 1, 2
        return u_cache(U,n)

def u_cache(U,n):
    if U[n] is None:
        U[n] = u(n-2, U) / u(n-1, U)
    return U[n]