def clamp(x, low, high): return max(low, min(x, high))