""" make a bunch tuples of range() objects for each decoration and then if in the object add n """ n, l, max_spook = tuple(map(int, input().split(" "))) candy = 0 decorations = [] for _ in range(n): a, b, s = tuple(map(int, input().split(" "))) decorations.append((range(a, b+1), s)) for i in range(l): spook_factor = 0 for deco, spookiness in decorations: if i in deco: spook_factor += abs(spookiness) if spook_factor < max_spook: candy += 1 if candy == 1: print(0) #off by one error lol else: print(candy)