I = TypeVar('I', int32, float, Vec) class Vec: v: list[int32] def __init__(self, v: list[int32]): self.v = v def __add__(self, other: I) -> Vec: if type(other) == int32: return Vec([v + other for v in self.v]) elif type(other) == float: return Vec([v + int32(other) for v in self.v]) else: return Vec([self.v[i] + other.v[i] for i in range(len(self.v))]) T = TypeVar('T', int32, list[int32]) def add(a: int32, b: T) -> int32: if type(b) == int32: return a + b else: for x in b: a = add(a, x) return a