def flatten(inp):
    """
    Flatten input array
    :param inp:
    :return:
    """
    if isinstance(inp, list):
        if len(inp) == 0:
            return []
        first, rest = inp[0], inp[1:]
        return flatten(first) + flatten(rest)
    else:
        return [inp]