Find a recursive solution for the Fibonacci sequence with a twist.
Implement fib_twist(n, first, second), where the twist is that the first two terms are configurable and repeated recursive subproblems must be avoided with memoization. Return the term at zero-based index n.
Contract: n is a nonnegative integer, first and second are integers. For example, fib_twist(4, 2, 3) returns 13, and fib_twist(0, 8, 13) returns 8. Use recursion and support 0 <= n <= 900.
def fib_twist(n, first, second):