# https://www.hackerrank.com/challenges/fibonacci-modified/problem

fib = [0, 1]

def fibMod(n):
    global fib
    while n > len(fib):
        fib += [fib[-2] + fib[-1]**2]
    return fib[n-1]


print(fibMod(5))
print(fibMod(3))
print(fibMod(8))


d97428d47f6c9fc6fa4fb7940159d55ab86afa19
<mask token>

<mask token>


def fibMod(n):
    global fib
    while n > len(fib):
        fib += [fib[-2] + fib[-1] ** 2]
    return fib[n - 1]


<mask token>

<mask token>


def fibMod(n):
    global fib
    while n > len(fib):
        fib += [fib[-2] + fib[-1] ** 2]
    return fib[n - 1]


print(fibMod(5))
print(fibMod(3))
print(fibMod(8))

fib = [0, 1]


def fibMod(n):
    global fib
    while n > len(fib):
        fib += [fib[-2] + fib[-1] ** 2]
    return fib[n - 1]


print(fibMod(5))
print(fibMod(3))
print(fibMod(8))

# https://www.hackerrank.com/challenges/fibonacci-modified/problem

fib = [0, 1]

def fibMod(n):
    global fib
    while n > len(fib):
        fib += [fib[-2] + fib[-1]**2]
    return fib[n-1]


print(fibMod(5))
print(fibMod(3))
print(fibMod(8))

