import functools


def chain(*funcs):
    """
    Returns a new function that is the composition of the given functions from left
    to right, e.g. `chain(p, q, r) == lambda *args, **kwargs: r(q(p(*args, **kwargs)))`
    
    All functions except the first should be functions of a single argument
    
    >>> def double(x): return x * 2
    ...
    >>> def third(x): return x // 3
    ...
    >>> def add(x, y): return x + y
    ...
    >>> f = chain(add, third, double)
    >>> f(2, 4)
    4
    """
    if not funcs:
        raise ValueError('At least one function must be given')
    funcs = list(funcs)
    first = funcs.pop(0)
    def exec_chain(*args, **kwargs):
        return functools.reduce(lambda result, f: f(result), funcs, first(*args, **kwargs))
    return exec_chain