from functools import reduce
from operator import or_


def variables(formula):
    """
    set of variables in formula
    >>> variables([1,(1,-2),(3,4),(-3,-1)])
        {1, 2, 3, 4}
    """
    return reduce(or_,map(lambda x:set(map(abs,x)), formula[1:]))