N, V, L = map(int, input().split()) inf = 10**18 dp = [inf]*(V+1) dp[V] = 0 bx = 0 for _ in range(N): ndp = [inf] * (V+1) x, v, w = map(int, input().split()) for vl in range(V+1): if vl+(x-bx) > V: continue ndp[vl] = dp[vl+(x-bx)] for vl in range(V+1): ndp[min(vl+v, V)] = min(ndp[min(vl+v, V)], ndp[vl]+w) dp = ndp[:] bx = x R = inf for i in range(L-bx, V+1): R = min(R, dp[i]) if R >= inf: print(-1) else: print(R)