def fun(x): import math if 0 <= x < 20 or x >= 30: return math.sqrt((math.pi)**3 * x) elif x < 0: return math.cos(x) else: return -1