def sum(list):
    """Return the sum of all integers in the given list."""
    if list == ():
        return 0
    else:
        head, tail = list
        if isinstance(head, int):
            return head + sum(tail)
        else:
            return sum(tail)