def ribbon(dimensions):
    """Return total ribbon needed for box of size dimensions

    The total ribbon is equal to twice the lengths of the shortest two
    dimensions plus the product of all three dimensions.
    """
    s1, s2, s3 = sorted(dimensions)
    return (2 * s1) + (2 * s2) + (s1 * s2 * s3)