def applyFunc(func, num, input):
    """Recursively applies a given function 'num' times.
    Assumes func takes input as its sole argument, and returns something equivalent."""
    cur = input
    for i in range(num):
        cur = func(cur)
    return cur