import os
import sys
from io import BytesIO, IOBase
# region fastio

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# ------------------------------

def RL(): return map(int, sys.stdin.readline().rstrip().split())
def RLL(): return list(map(int, sys.stdin.readline().rstrip().split()))
def N(): return int(input())
def comb(n, m): return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0
def perm(n, m): return factorial(n) // (factorial(n - m)) if n >= m else 0
def mdis(x1, y1, x2, y2): return abs(x1 - x2) + abs(y1 - y2)
def toord(c): return ord(c)-ord('a')
def lcm(a, b): return a*b//lcm(a, b)
mod = 998244353
INF = float('inf')
from math import factorial, sqrt, ceil, floor, gcd
from collections import Counter, defaultdict, deque
from heapq import heapify, heappop, heappush
from bisect import bisect_right

# ------------------------------
# f = open('./input.txt')
# sys.stdin = f

def main():
    for _ in range(N()):
        n, s = RL()
        arr = RLL()

        sm = [0]
        for i in range(n):
            sm.append(sm[-1]+arr[i])

        if sm[-1]<=s:
            print(0)
            continue

        ma = 0
        ind = -1
        for i in range(n):
            now = sm[i+1]
            if arr[i]>ma:
                ma = arr[i]
                ind = i
            if now>s:
                print(1+ind)
                break
if __name__ == "__main__":
    main()


def count_verses(verses, length, maximum):
    verses_count = 0
    biggest_index = 0

    for i in range(length):
        if maximum < verses[i]:
            break
        verses_count += 1
        biggest_index = i if verses[i] > verses[biggest_index] else biggest_index
        maximum -= verses[i]

    # print(verses_count)
    # print(maximum)
    # print("hope is:", maximum + verses[biggest_index])
    # print("currently at:", verses[verses_count])
    if 0 <= verses_count < length:
        if maximum + verses[biggest_index] > verses[verses_count]:
            return biggest_index + 1
        elif verses_count < length - 1 and maximum + verses[verses_count] >= verses[verses_count] + 1:
            return verses_count + 1

    return 0

def solution(inp1, inp2):
    length = inp1[0]
    maximum = inp1[1]
    return count_verses(inp2, length, maximum)

def main():
    inp1 = input()
    length = int(inp1)

    for i in range(length):
        inp1 = list(map(int, input().split()))
        inp2 = list(map(int, input().split()))
        result = solution(inp1, inp2)
        print(result)

if __name__ == "__main__":
    main()


def count_verses(verses, length, maximum):
    biggest_index = 0

    i = 0
    while i < length and maximum >= 0:
        biggest_index = i if verses[i] > verses[biggest_index] else biggest_index
        maximum -= verses[i]

    if maximum < 0:
        return biggest_index
    return 0

def solution(inp1, inp2):
    length = inp1[0]
    maximum = inp1[1]
    return count_verses(inp2, length, maximum)

def main():
    inp1 = input()
    length = int(inp1)

    for i in range(length):
        inp1 = list(map(int, input().split()))
        inp2 = list(map(int, input().split()))
        result = solution(inp1, inp2)
        print(result)

if __name__ == "__main__":
    main()


def count_verses(verses, length, maximum):
    biggest_index = 0

    i = 0
    while i < length and maximum >= 0:
        biggest_index = i if verses[i] > verses[biggest_index] else biggest_index
        maximum -= verses[i]
        i += 1

    if maximum < 0:
        return biggest_index + 1
    return 0

def solution(inp1, inp2):
    length = inp1[0]
    maximum = inp1[1]
    return count_verses(inp2, length, maximum)

def main():
    inp1 = input()
    length = int(inp1)

    for i in range(length):
        inp1 = list(map(int, input().split()))
        inp2 = list(map(int, input().split()))
        result = solution(inp1, inp2)
        print(result)

if __name__ == "__main__":
    main()


from sys import stdin
for _ in range(int(stdin.readline().rstrip())):
    n, s = map(int, stdin.readline().rstrip().split(" "))
    l = list(map(int, stdin.readline().rstrip().split(" ")))
    r = -1
    m = 0
    check = False
    for i in range(0,n):
        if l[i] > s:
            s = s + m
            if l[i]>s:
                r = -1
            check=True
            break

        else:
            if l[i] > m:
                m = l[i]
                r = i
        s-=l[i]
    if not check:
        print(0)
    else:
        print(r+1)


from sys import stdin
for _ in range(int(stdin.readline().rstrip())):
    n, s = map(int, stdin.readline().rstrip().split(" "))
    l = list(map(int, stdin.readline().rstrip().split(" ")))
    r = -1
    m = 0
    check = False
    for i in range(0,n):
        if l[i] > m:
            m = l[i]
            r = i
        if l[i] > s:
            s = s + m
            if l[i]>s:
                r = -1
            check=True
            break

        s-=l[i]
    if not check:
        print(0)
    else:
        print(r+1)


import sys
t=1
t=int(input())
for i in range(t):
    n,s=list(map(int,sys.stdin.readline().strip().split()))
    a=list(map(int,sys.stdin.readline().strip().split()))
    # x=sys.stdin.readline().strip()
    # a.sort()
    # if(a[0]+a[1]>a[2]-2):
    #     print("YES")
    # else:
    #     print("NO")
    mtl=0
    stl=0
    j=0
    while(j<n and stl+a[j]<=s):
        stl=stl+a[j]
        if(a[j]>a[mtl]):
            mtl=j
        j+=1

    if(stl<=s):
        if(j==n):
            print(0)
        else:
            # print(j,n,s,stl,mtl)
            if(a[j]<=a[mtl]):
                print(mtl+1)
            else:
                print(0)
    # else:


import sys
t=1
t=int(input())
for i in range(t):
    n,s=list(map(int,sys.stdin.readline().strip().split()))
    a=list(map(int,sys.stdin.readline().strip().split()))
    # x=sys.stdin.readline().strip()
    # a.sort()
    # if(a[0]+a[1]>a[2]-2):
    #     print("YES")
    # else:
    #     print("NO")
    mtl=0
    stl=0
    j=0
    s1=0
    while(j<n and stl+a[j]<=s):
        stl=stl+a[j]
        s1=s1+1
        if(a[j]>a[mtl]):
            mtl=j
        j+=1

    # if(stl<=s):
    #     if(j==n):
    #         print(0)
    #     else:
    #         # print(j,n,s,stl,mtl)
    #         if(a[j]<=a[mtl]):
    #             print(mtl+1)
    #         else:
    #             print(0)
    # # else:

    if(j==n):
        print(0)
    else:
        if(a[j]>a[mtl]):
            mtl=j
        # print(a)
        a.pop(mtl)
        # print(a)
        n=n-1
        # mtl=0
        stl2=0
        j=0
        s2=0
        while(j<n and stl2+a[j]<=s):
            stl2=stl2+a[j]
            s2=s2+1
            # if(a[j]>a[mtl]):
            #     mtl=j
            j+=1
        if(s2>s1):
            print(mtl+1)
        else:
            # print(0,stl,stl2,a)
            print(0)


import sys
t=1
t=int(input())
for i in range(t):
    n,s=list(map(int,sys.stdin.readline().strip().split()))
    a=list(map(int,sys.stdin.readline().strip().split()))
    # x=sys.stdin.readline().strip()
    # a.sort()
    # if(a[0]+a[1]>a[2]-2):
    #     print("YES")
    # else:
    #     print("NO")
    mtl=0
    stl=0
    j=0
    s1=0
    while(j<n and stl+a[j]<=s):
        stl=stl+a[j]
        s1=s1+1
        if(a[j]>a[mtl]):
            mtl=j
        j+=1

    # if(stl<=s):
    #     if(j==n):
    #         print(0)
    #     else:
    #         # print(j,n,s,stl,mtl)
    #         if(a[j]<=a[mtl]):
    #             print(mtl+1)
    #         else:
    #             print(0)
    # # else:

    if(j==n):
        print(0)
    else:
        # print(a)
        a.pop(mtl)
        # print(a)
        n=n-1
        # mtl=0
        stl2=0
        j=0
        s2=0
        while(j<n and stl2+a[j]<=s):
            stl2=stl2+a[j]
            s2=s2+1
            # if(a[j]>a[mtl]):
            #     mtl=j
            j+=1
        if(s2>s1):
            print(mtl+1)
        else:
            # print(0,stl,stl2,a)
            print(0)


import sys
t=1
t=int(input())
for i in range(t):
    n,s=list(map(int,sys.stdin.readline().strip().split()))
    a=list(map(int,sys.stdin.readline().strip().split()))
    # x=sys.stdin.readline().strip()
    # a.sort()
    # if(a[0]+a[1]>a[2]-2):
    #     print("YES")
    # else:
    #     print("NO")
    mtl=0
    stl=0
    j=0
    while(j<n and stl+a[j]<=s):
        stl=stl+a[j]
        if(a[j]>a[mtl]):
            mtl=j
        j+=1

    if(stl<=s):
        if(j==n):
            print(0)
        else:
            # print(j,n,s,stl,mtl)
            if(a[j]<a[mtl]):
                print(mtl+1)
            else:
                print(0)
    # else:


import sys
import bisect as b
input=sys.stdin.readline
def cin():
    return map(int,sin().split())
def ain():
    return list(map(int,sin().split()))
def sin():
    return input()
def inin():
    return int(input())

for i in range(inin()):
    n,s=cin()
    a=ain()
##    pre=[0]*n
##    pre[0]=l[0]
##    for i in range(1,n):
##        pre[i]=pre[i-1]+l[i]
    if(sum(a)<=s):
        print(0)
    else:
        mxi = 0
        total = 0
        for i in range( n):
            if total + a[i] > s:
                ans= (i + 1) if a[i] > a[mxi] else mxi + 1
            else:
                total += a[i]
                if a[i] > a[mxi]:
                    mxi = i
        print(ans)


import sys
import bisect as b
input=sys.stdin.readline
def cin():
    return map(int,sin().split())
def ain():
    return list(map(int,sin().split()))
def sin():
    return input()
def inin():
    return int(input())
def solve(n, s, a):
    mxi = 0
    total = 0
    for i in range(0, n):
        if total + a[i] > s:
            return i + 1 if a[i] > a[mxi] else mxi + 1
        else:
            total += a[i]
            if a[i] > a[mxi]:
                mxi = i
    return 0

for i in range(inin()):
    n,s=cin()
    l=ain()
    print(solve(n,s,l))


t = int(input())
for f in range(t):
    n, s = map(int, input().split())
    a = [int(s) for s in input().split()]
    if n == 1 or sum(a) <= s:
        print(0)
    else:
        i = 1
        while True:
            if sum(a[0 : i]) <= s:
                i += 1
            else:
                break
        print(a.index(max(a[0:i]))+1)


t = int(input())
for f in range(t):
    n, s = map(int, input().split())
    a = [int(s) for s in input().split()]
    if n == 1 or sum(a) <= s:
        print(0)
    else:
        summ = 0
        i = 0
        while True:
            summ += a[i]
            if summ <= s:
                i += 1
            else:
                break
        print(a.index(max(a[0:i]))+1)


t = int(input())
for f in range(t):
    n, s = map(int, input().split())
    a = [int(s) for s in input().split()]
    if n == 1 or sum(a) <= s:
        print(0)
    else:
        summ = 0
        i = 0
        while True:
            summ += a[i]
            if summ <= s:
                i += 1
            else:
                break
        print(a.index(max(a[0:i+1]))+1)


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

from bisect import bisect_right

def solve():
    n, s = map(int, input().split())
    a = list(map(int, input().split()))
    cs = [0]
    for i in range(n):
        cs.append(cs[-1]+a[i])
    if cs[-1] <= s:
        print(0)
        return
    max_ = 0
    ans = 0
    for i in range(n):
        ns = s+a[i]
        j = bisect_right(cs, ns)
        if j-2 > max_:
            ans = i+1
            max_ = j-2
    print(ans)

t = int(input())
for i in range(t):
    solve()


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

from bisect import bisect_right

def solve():
    n, s = map(int, input().split())
    a = list(map(int, input().split()))
    cs = [a[0]]
    for i in range(n-1):
        cs.append(cs[-1]+a[i+1])
    if cs[-1] <= s:
        print(0)
        return
    max_ = 0
    ans = 1
    for i in range(n):
        ns = s+a[i]
        j = bisect_right(cs, ns)
        if j <= i:
            continue
        if j-1 > max_:
            ans = i+1
            max_ = j-1
    print(ans)

t = int(input())
for i in range(t):
    solve()


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

from bisect import bisect_right

def solve():
    n, s = map(int, input().split())
    a = list(map(int, input().split()))
    cs = [a[0]]
    for i in range(n-1):
        cs.append(cs[-1]+a[i+1])
    if cs[-1] <= s:
        print(0)
        return
    max_ = 0
    ans = 1
    for i in range(n):
        ns = s+a[i]
        j = bisect_right(cs, ns)
        if j-1 > max_:
            ans = i+1
            max_ = j-1
    print(ans)

t = int(input())
for i in range(t):
    solve()


import sys
import math
from collections import Counter
import bisect

ma=lambda:map(int,input().split())
inp=lambda:[int(i) for i in input().split()]
s=sorted

for _ in range(int(input())):
    n,s=ma()
    a=inp()
    val=0
    values=[]
    for i in range(n):
        if(val+a[i]>s):
            break
        else:
            val+=a[i]
            values.append(a[i])
    if(len(values)==0):
        print(1)
        sys.exit(0)
    elif(len(values)==n):
        print(0)
    else:
        x=max(values)
        print(values.index(x)+1)


import sys
import math
from collections import Counter
import bisect

ma=lambda:map(int,input().split())
inp=lambda:[int(i) for i in input().split()]
s=sorted

for _ in range(int(input())):
    n,s=ma()
    a=inp()
    val=0
    values=[]
    for i in range(n):
        if(val+a[i]>s):
            break
        else:
            val+=a[i]
            values.append(a[i])

    if(len(values)==n):
        print(0)
    else:
        x=max(values)
        print(values.index(x)+1)


import sys
import math
from collections import Counter
import bisect

ma=lambda:map(int,input().split())
inp=lambda:[int(i) for i in input().split()]
s=sorted

for _ in range(int(input())):
    n,s=ma()
    a=inp()
    val=0

    maxi=0
    ind=0
    flag=0
    for i in range(n):
        if(val+a[i]>s):
            if(maxi>a[i]):
                print(ind+1)
                flag=1
                break

            else:

                print(i+1)
                flag=1
                break

        else:
            val+=a[i]
            if(a[i]>maxi):
                ind=i
                maxi=a[i]

    if(flag==0):
        print(0)


q = int(input())
for rw in range(q):
	n,s = map(int,input().split())
	l = list(map(int,input().split()))
	pref = [0] * n
	pref[0] = l[0]
	for i in range(1,n):
		pref[i] = pref[i-1] + l[i]
	if sum(l) <= s:
		print(0)
	else:
		wyn = 1
		best = 0
		#print(pref)
		for i in range(n):
			le = i
			p = n - 1
			mid = n - 1
			while True:
				if abs(le-p) == 0:
					#print(le,p,"BREJK")
					break
				mid = (p+le+1)//2
				if pref[mid] - l[i] > s:
					p = mid - 1
				else:
					le = mid
			mid = (le+p)//2
			#print(i,mid)########
			if pref[mid] - l[i] <= s:
				#print(pref[mid] - l[i], i)
				if mid > best:
					best = mid
					wyn = i + 1
		i = -1
		while i < n - 1:
			if pref[i + 1] <= s:
				i += 1
			else:
				break
		if i >= best:
			print(n)
		else:
			print(wyn)


q = int(input())
for rw in range(q):
	n,s = map(int,input().split())
	l = list(map(int,input().split()))
	pref = [0] * n
	pref[0] = l[0]
	for i in range(1,n):
		pref[i] = pref[i-1] + l[i]
	if sum(l) <= s:
		print(0)
	else:
		wyn = 1
		best = 0
		for i in range(n):
			le = i
			p = n - 1
			mid = n - 1
			while abs(le-p) > 0:
				mid = (p+le+1)//2
				if pref[mid] - l[i] > s:
					p = mid - 1
				else:
					le = mid
			if pref[mid] - l[i] <= s:
				if mid > best:
					best = mid
					wyn = i + 1
		print(wyn)


q = int(input())
for rw in range(q):
	n,s = map(int,input().split())
	l = list(map(int,input().split()))
	pref = [0] * n
	pref[0] = l[0]
	for i in range(1,n):
		pref[i] = pref[i-1] + l[i]
	if sum(l) <= s:
		print(0)
	else:
		wyn = 1
		best = 0
		for i in range(n):
			le = i
			p = n - 1
			while abs(le-p) > 0:
				mid = (p+le+1)//2
				if pref[mid] - l[i] > s:
					p = mid - 1
				else:
					le = mid
			if pref[mid] - l[i] <= s:
				if mid > best:
					best = mid
					wyn = i + 1
		print(wyn)


q = int(input())
for rw in range(q):
	n,s = map(int,input().split())
	l = list(map(int,input().split()))
	pref = [0] * n
	pref[0] = l[0]
	for i in range(1,n):
		pref[i] = pref[i-1] + l[i]
	if sum(l) <= s:
		print(0)
	else:
		wyn = 1
		best = 0
		for i in range(n):
			le = i
			p = n - 1
			mid = n - 1
			while abs(le-p) > 0:
				mid = (p+le+1)//2
				if pref[mid] - l[i] > s:
					p = mid - 1
				else:
					le = mid
			if pref[mid] - l[i] <= s:
				#print(pref[mid] - l[i], i)
				if mid > best:
					best = mid
					wyn = i + 1
		i = -1
		while i < n - 1:
			if pref[i + 1] <= s:
				i += 1
			else:
				break
		if i >= best:
			print(n)
		else:
			print(wyn)


import sys
from math import gcd
from heapq import heappop
from heapq import heappush
from heapq import heapify
from bisect import insort
from bisect import bisect_right
from bisect import bisect_left
from sys import stdin,stdout
from collections import defaultdict, deque
from math import log2, ceil, floor

inp=lambda : int(input())
sip=lambda : input()
mulip =lambda : map(int,input().split())
lst=lambda : list(map(int,input().split()))
slst=lambda: list(sip())
arr2d= lambda x: [[int(j) for j in input().split()] for i in range(x)]
odds = lambda l: len(list(filter(lambda x: x%2!=0, l)))
evens = lambda l: len(list(filter(lambda x: x%2==0, l)))
mod = pow(10,9)+7
#-------------------------------------------------------
Judge = 0
if Judge:
    sys.stdin = open("input.in",'r')
    #sys.stdout = open("output.in",'w')

for _ in range(inp()):
    n,s = mulip()
    a = lst()
    M = []
    s1 = 0
    for i in range(n):
        s1+=a[i]
        M.append(s1)
    if M[-1]<=s:
        print(0)
    else:
        cnt = 0
        for i in range(n):
            if s>=M[i]:
                cnt+=1
        if cnt>n//2:
            print(1)
        else:
            print(2)


import sys
from math import gcd
from heapq import heappop
from heapq import heappush
from heapq import heapify
from bisect import insort
from bisect import bisect_right
from bisect import bisect_left
from sys import stdin,stdout
from collections import defaultdict, deque
from math import log2, ceil, floor

inp=lambda : int(input())
sip=lambda : input()
mulip =lambda : map(int,input().split())
lst=lambda : list(map(int,input().split()))
slst=lambda: list(sip())
arr2d= lambda x: [[int(j) for j in input().split()] for i in range(x)]
odds = lambda l: len(list(filter(lambda x: x%2!=0, l)))
evens = lambda l: len(list(filter(lambda x: x%2==0, l)))
mod = pow(10,9)+7
#-------------------------------------------------------
Judge = 0
if Judge:
    sys.stdin = open("input.in",'r')
    #sys.stdout = open("output.in",'w')

for _ in range(inp()):
    n,s = mulip()
    a = lst()
    b = list(a)
    b = sorted(b)
    idx = 0
    x = b[0]
    d = defaultdict(int)
    for i in range(1,n):
        if s>x+b[i]:
            x += b[i]
            d[b[i]]+=1
            idx += 1
    if idx==n-1:
        print(0)
        #print(idx)
    elif idx == n-2:
        print(1)
    else:
        skip = 0
        i=0
        while(i<n-1):
            if a[i] not in d and a[i+1] in d:
                skip+=1
            i += 1
        if a[-1] not in d and a[-2] not in d:
            skip+=1
        print(skip)


import sys
from math import gcd
from heapq import heappop
from heapq import heappush
from heapq import heapify
from bisect import insort
from bisect import bisect_right
from bisect import bisect_left
from sys import stdin,stdout
from collections import defaultdict, deque
from math import log2, ceil, floor

inp=lambda : int(input())
sip=lambda : input()
mulip =lambda : map(int,input().split())
lst=lambda : list(map(int,input().split()))
slst=lambda: list(sip())
arr2d= lambda x: [[int(j) for j in input().split()] for i in range(x)]
odds = lambda l: len(list(filter(lambda x: x%2!=0, l)))
evens = lambda l: len(list(filter(lambda x: x%2==0, l)))
mod = pow(10,9)+7
#-------------------------------------------------------
Judge = 0
if Judge:
    sys.stdin = open("input.in",'r')
    #sys.stdout = open("output.in",'w')

for _ in range(inp()):
    n,s = mulip()
    a = lst()
    sm = 0
    ans = 0
    idx = 0
    for i in range(n):
        if a[i]>a[idx]:
            idx = i
        sm += a[i]
        if sm>s and sm-a[idx]<=s:
            ans = idx+1
    print(ans)


import math
t=int(input())
for _ in range(t):
  n,s=map(int,input().split())
  l=list(map(int,input().split()))
  if sum(l)<=s:
    print(0)
    continue
  ans=0
  summ=0
  maxi=0
  ind=0
  for i in range(n):
    summ=summ+l[i]
    if summ>s:
      if maxi>l[i]:
        ans=ind+1
      else:
        ans=i+1
      break
    if l[i]>maxi:
      ind=i
      maxi=l[i]
  print(ans)


import math
t=int(input())
for _ in range(t):
  n,s=map(int,input().split())
  l=list(map(int,input().split()))
  if sum(l)<=s:
    print(0)
    continue
  ans=0
  summ=0
  maxi=0
  ind=0
  for i in range(n):
    summ=summ+l[i]
    if summ>s:
      if summ-maxi<=s:
        ans=ind+1
      break
    if l[i]>maxi:
      ind=i
      maxi=l[i]
  print(ans)


import java.io.*;
import java.util.*;
import java.math.*;
import java.util.concurrent.*;

public final class cunning_gena
{
    static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	static FastScanner sc=new FastScanner(br);
    static PrintWriter out=new PrintWriter(System.out);
	static Random rnd=new Random();
	static Pair[] a;
	static long[][] dp;

    public static void main(String args[]) throws Exception
    {
		int n=sc.nextInt(),m=sc.nextInt(),b=sc.nextInt();a=new Pair[n];

		for(int i=0;i<n;i++)
		{
			int mask=0;long cost=sc.nextLong(),k=sc.nextLong();int x=sc.nextInt();

			for(int j=0;j<x;j++)
			{
				int idx=sc.nextInt()-1;

				mask|=(1<<idx);
			}

			a[i]=new Pair(mask,cost,k);
		}

		Arrays.sort(a);dp=new long[n][1<<m];

		for(int i=0;i<n;i++)
		{
			for(int j=0;j<(1<<m);j++)
			{
				dp[i][j]=Long.MAX_VALUE;
			}
		}

		dp[0][a[0].mask]=a[0].cost;

		for(int i=1;i<n;i++)
		{
			int mask=a[i].mask;

			for(int j=0;j<(1<<m);j++)
			{
				if(dp[i-1][j]<Long.MAX_VALUE)
				{
					dp[i][j|mask]=Math.min(dp[i][j|mask],dp[i-1][j]+a[i].cost);
				}
			}

			for(int j=0;j<(1<<m);j++)
			{
				dp[i][j]=Math.min(dp[i][j],dp[i-1][j]);
			}
		}

		long min=Long.MAX_VALUE;

		for(int i=0;i<n;i++)
		{
			if(dp[i][(1<<m)-1]<Long.MAX_VALUE)
			{
				min=Math.min(min,dp[i][(1<<m)-1]+(a[i].k*b));
			}
		}

		out.println(min<Long.MAX_VALUE?min:-1);out.close();
    }
}

class Pair implements Comparable<Pair>
{
	int mask;long cost,k;

	public Pair(int mask,long cost,long k)
	{
		this.mask=mask;this.cost=cost;this.k=k;
	}

	public int compareTo(Pair x)
	{
		return Long.compare(this.k,x.k);
	}
}
class FastScanner
{
    BufferedReader in;
    StringTokenizer st;

    public FastScanner(BufferedReader in) {
        this.in = in;
    }

    public String nextToken() throws Exception {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }

	public String next() throws Exception {
		return nextToken().toString();
	}

    public int nextInt() throws Exception {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws Exception {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws Exception {
        return Double.parseDouble(nextToken());
    }
}


import java.io.*;
import java.util.*;
import java.math.*;
import java.util.concurrent.*;

public final class cunning_gena
{
    static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	static FastScanner sc=new FastScanner(br);
    static PrintWriter out=new PrintWriter(System.out);
	static Random rnd=new Random();
	static Pair[] a;
	static long[][] dp;

    public static void main(String args[]) throws Exception
    {
		int n=sc.nextInt(),m=sc.nextInt(),b=sc.nextInt();a=new Pair[n];

		for(int i=0;i<n;i++)
		{
			long cost=sc.nextLong(),k=sc.nextLong();int x=sc.nextInt(),mask=0;

			for(int j=0;j<x;j++)
			{
				int idx=sc.nextInt()-1;

				mask|=(1<<idx);
			}

			a[i]=new Pair(mask,cost,k);
		}

		Arrays.sort(a);dp=new long[n][1<<m];

		for(int i=0;i<n;i++)
		{
			for(int j=0;j<(1<<m);j++)
			{
				dp[i][j]=Long.MAX_VALUE;
			}
		}

		dp[0][a[0].mask]=a[0].cost;dp[0][0]=0;

		for(int i=1;i<n;i++)
		{
			int mask=a[i].mask;

			for(int j=0;j<(1<<m);j++)
			{
				if(dp[i-1][j]<Long.MAX_VALUE)
				{
					dp[i][j|mask]=Math.min(dp[i][j|mask],dp[i-1][j]+a[i].cost);
				}
			}

			for(int j=0;j<(1<<m);j++)
			{
				dp[i][j]=Math.min(dp[i][j],dp[i-1][j]);
			}
		}

		long min=Long.MAX_VALUE;

		for(int i=0;i<n;i++)
		{
			if(dp[i][(1<<m)-1]<Long.MAX_VALUE)
			{
				min=Math.min(min,dp[i][(1<<m)-1]+(a[i].k*b));
			}
		}

		out.println(min<Long.MAX_VALUE?min:-1);out.close();
    }
}

class Pair implements Comparable<Pair>
{
	int mask;long cost,k;

	public Pair(int mask,long cost,long k)
	{
		this.mask=mask;this.cost=cost;this.k=k;
	}

	public int compareTo(Pair x)
	{
		return Long.compare(this.k,x.k);
	}
}
class FastScanner
{
    BufferedReader in;
    StringTokenizer st;

    public FastScanner(BufferedReader in) {
        this.in = in;
    }

    public String nextToken() throws Exception {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }

	public String next() throws Exception {
		return nextToken().toString();
	}

    public int nextInt() throws Exception {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws Exception {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws Exception {
        return Double.parseDouble(nextToken());
    }
}


import java.io.*;
import java.util.*;
import java.math.*;
import java.util.concurrent.*;

public final class xx
{
    static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	static FastScanner sc=new FastScanner(br);
    static PrintWriter out=new PrintWriter(System.out);
	static Random rnd=new Random();
	static Pair[] a;
	static long[][] dp;

    public static void main(String args[]) throws Exception
    {
		int n=sc.nextInt(),m=sc.nextInt(),b=sc.nextInt();a=new Pair[n];

		for(int i=0;i<n;i++)
		{
			long cost=sc.nextLong(),k=sc.nextLong();int x=sc.nextInt(),mask=0;

			for(int j=0;j<x;j++)
			{
				int idx=sc.nextInt()-1;

				mask|=(1<<idx);
			}

			a[i]=new Pair(mask,cost,k);
		}

		Arrays.sort(a);int ff=(1<<m)-1;dp=new long[2][1<<m];

		for(int i=0;i<2;i++)
		{
			for(int j=0;j<(1<<m);j++)
			{
				dp[i][j]=Long.MAX_VALUE;
			}
		}

		dp[0][a[0].mask]=a[0].cost;dp[0][0]=0;

		long min=dp[0][ff]<Long.MAX_VALUE?dp[0][ff]+(a[0].k*b):Long.MAX_VALUE;

		for(int i=1,x=1;i<n;i++,x=1^x)
		{
			int mask=a[i].mask;

			for(int j=0;j<(1<<m);j++)
			{
				dp[x][j]=Math.min(dp[x][j],dp[x^1][j]);
			}

			for(int j=0;j<(1<<m);j++)
			{
				if(dp[x^1][j]<Long.MAX_VALUE)
				{
					dp[x][j|mask]=Math.min(dp[x][j|mask],dp[x^1][j]+a[i].cost);
				}
			}

			if(dp[x][ff]<Long.MAX_VALUE)
			{
				min=Math.min(min,dp[x][ff]+(a[i].k*b));
			}
		}

		out.println(min<Long.MAX_VALUE?min:-1);out.close();
    }
}

class Pair implements Comparable<Pair>
{
	int mask;long cost,k;

	public Pair(int mask,long cost,long k)
	{
		this.mask=mask;this.cost=cost;this.k=k;
	}

	public int compareTo(Pair x)
	{
		return Long.compare(this.k,x.k);
	}
}
class FastScanner
{
    BufferedReader in;
    StringTokenizer st;

    public FastScanner(BufferedReader in) {
        this.in = in;
    }

    public String nextToken() throws Exception {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }

	public String next() throws Exception {
		return nextToken().toString();
	}

    public int nextInt() throws Exception {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws Exception {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws Exception {
        return Double.parseDouble(nextToken());
    }
}


import java.io.*;
import java.util.*;
import java.math.*;
import java.util.concurrent.*;

public final class cunning_gena
{
    static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	static FastScanner sc=new FastScanner(br);
    static PrintWriter out=new PrintWriter(System.out);
	static Random rnd=new Random();
	static Pair[] a;
	static long[] dp;

    public static void main(String args[]) throws Exception
    {
		int n=sc.nextInt(),m=sc.nextInt(),b=sc.nextInt();a=new Pair[n];

		for(int i=0;i<n;i++)
		{
			long cost=sc.nextLong(),k=sc.nextLong();int x=sc.nextInt(),mask=0;

			for(int j=0;j<x;j++)
			{
				int idx=sc.nextInt()-1;

				mask|=(1<<idx);
			}

			a[i]=new Pair(mask,cost,k);
		}

		Arrays.sort(a);int ff=(1<<m)-1;dp=new long[1<<m];

		for(int j=0;j<(1<<m);j++)
		{
			dp[j]=Long.MAX_VALUE;
		}

		dp[a[0].mask]=a[0].cost;dp[0]=0;

		long min=dp[ff]<Long.MAX_VALUE?dp[ff]+(a[0].k*b):Long.MAX_VALUE;

		for(int i=1;i<n;i++)
		{
			int mask=a[i].mask;

			for(int j=(1<<m)-1;j>=0;j--)
			{
				if(dp[j]<Long.MAX_VALUE)
				{
					dp[j|mask]=Math.min(dp[j|mask],dp[j]+a[i].cost);
				}
			}

			if(dp[ff]<Long.MAX_VALUE)
			{
				min=Math.min(min,dp[ff]+(a[i].k*b));
			}
		}

		out.println(min<Long.MAX_VALUE?min:-1);out.close();
    }
}

class Pair implements Comparable<Pair>
{
	int mask;long cost,k;

	public Pair(int mask,long cost,long k)
	{
		this.mask=mask;this.cost=cost;this.k=k;
	}

	public int compareTo(Pair x)
	{
		return Long.compare(this.k,x.k);
	}
}
class FastScanner
{
    BufferedReader in;
    StringTokenizer st;

    public FastScanner(BufferedReader in) {
        this.in = in;
    }

    public String nextToken() throws Exception {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }

	public String next() throws Exception {
		return nextToken().toString();
	}

    public int nextInt() throws Exception {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws Exception {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws Exception {
        return Double.parseDouble(nextToken());
    }
}


import java.io.*;
import java.util.*;
public class cf417d {
    private static final long INF = Long.MAX_VALUE;
    private void solve() throws IOException {
        int n = nextInt(), m = nextInt();
        long b = nextInt();
        Friend[] f = new Friend[n];
        for (int i = 0; i < n; i++) {
            long x = nextInt();
            long k = nextInt();
            int mm = nextInt();
            int p = 0;
            for (int j = 0; j < mm; j++) {
                p |= 1 << (nextInt() - 1);
            }
            f[i] = new Friend(x, k, p);
        }
        Arrays.sort(f, new Comparator<Friend>() {
            public int compare(Friend o1, Friend o2) {
                return Long.compare(o1.k, o2.k);
            }
        });
        long[] d = new long[1 << m];
        Arrays.fill(d, INF);
        d[0] = 0;
        long res = INF;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < 1 << m; j++) if (d[j] < INF) {
                int jj = j | f[i].p;
                d[jj] = Math.min(d[jj], d[j] + f[i].x);
            }
            if (d[(1 << m) - 1] < INF) {
                res = Math.min(res, d[(1 << m) - 1] + b * f[i].k);
            }
        }
        if (res == INF) {
            out.println(-1);
        } else {
            out.println(res);
        }
    }
    class Friend {
        long x,k;
        int p;
        Friend(long x, long k, int p) {
            this.x = x;
            this.k = k;
            this.p = p;
        }
    }
    BufferedReader br;
    StringTokenizer st;
    PrintWriter out;
    String next() throws IOException {
        while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }
    int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
    public static void main(String[] args) throws FileNotFoundException {
        new cf417d().run();
    }
    private void run() {
        try {
  //          br = new BufferedReader(new FileReader("cf417d.in"));
            br = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            solve();
        } catch (IOException e) {
            e.printStackTrace();
        }
        out.close();
    }
}


import java.io.*;
import java.util.Arrays;
import java.util.Comparator;
import java.util.StringTokenizer;

public class remote_pm {

    private static final long INF = Long.MAX_VALUE;

    private void solve() throws IOException {
        int n = nextInt();
        int m = nextInt();
        long b = nextInt();
        Friend[] f = new Friend[n];
        for (int i = 0; i < n; i++) {
            long x = nextInt();
            long k = nextInt();
            int mm = nextInt();
            int p = 0;
            for (int j = 0; j < mm; j++) {
                p |= 1 << (nextInt() - 1);
            }
            f[i] = new Friend(x, k, p);
        }
        Arrays.sort(f, new Comparator<Friend>() {
            public int compare(Friend o1, Friend o2) {
                return Long.compare(o1.k, o2.k);
            }
        });
        long[] d = new long[1 << m];
        Arrays.fill(d, INF);
        d[0] = 0;
        long res = INF;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < 1 << m; j++) if (d[j] < INF) {
                int jj = j | f[i].p;
                d[jj] = Math.min(d[jj], d[j] + f[i].x);
            }
            if (d[(1 << m) - 1] < INF) {
                res = Math.min(res, d[(1 << m) - 1] + b * f[i].k);
            }
        }

        if (res == INF) {
            out.println(-1);
        } else {
            out.println(res);
        }

    }

    class Friend {
        long x;
        long k;
        int p;
        Friend(long x, long k, int p) {
            this.x = x;
            this.k = k;
            this.p = p;
        }
    }

    BufferedReader br;
    StringTokenizer st;
    PrintWriter out;

    String next() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }

    int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    public static void main(String[] args) throws FileNotFoundException {
        new remote_pm().run();
    }

    private void run() {
        try {
            br = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
//            br = new BufferedReader(new FileReader("table.in"));
//            out = new PrintWriter("table.out");
            solve();
        } catch (IOException e) {
            e.printStackTrace();
        }
        out.close();
    }

}


import java.io.*;
import java.util.*;

public class Solution {

    BufferedReader br;
    PrintWriter out;
    StringTokenizer st;
    boolean eof;

    static final int Mod=1000000007;

    static class Friend {
        long x;
        long k;
        int p;
        Friend(long x,long k,int p) {
            this.x=x;
            this.k=k;
            this.p=p;
        }
    }

    void solve() throws IOException {
        int n=nextInt();
        int m=nextInt();
        int b=nextInt();
        Friend f[]=new Friend[n];
        for (int i = 0; i < n; i++) {
            long x=nextLong();
            long k=nextLong();
            int p=0;
            int cnt=nextInt();
            for (int j = 0; j < cnt; j++) {
                int idx=nextInt()-1;
                p|=1<<idx;
            }
            f[i]=new Friend(x,k,p);
        }
        Arrays.sort(f, new Comparator<Friend>() {
            @Override
            public int compare(Friend o1, Friend o2) {
                return Long.compare(o1.k,o2.k);
            }
        });
        long d[]=new long[1<<m];
        long ans=Long.MAX_VALUE;
        Arrays.fill(d,Long.MAX_VALUE);
        d[0]=0;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < 1 << m; j++) {
                if(d[j]<Long.MAX_VALUE) {
                    int q=j|f[i].p;
                    d[q]=Math.min(d[q],f[i].x+d[j]);
                }
            }
            if(d[(1<<m)-1]<Long.MAX_VALUE) {
                ans = Math.min(ans, d[(1<<m)-1]+f[i].k*b);
            }
        }
        if(ans==Long.MAX_VALUE) out.println(-1);
        else out.println(ans);
    }

    Solution() throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }

    public static void main(String[] args) throws IOException {
        new Solution();
    }

    String nextToken() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                eof = true;
                return null;
            }
        }
        return st.nextToken();
    }

    String nextString() {
        try {
            return br.readLine();
        } catch (IOException e) {
            eof = true;
            return null;
        }
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
}


import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Scanner;

public class D {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int m = scanner.nextInt();
		long b = scanner.nextInt();
		ArrayList<Friend> friends = new ArrayList<Friend>(n);
		for(int i = 0; i < n; i ++) {
			Friend f = new Friend(scanner.nextLong(), scanner.nextLong(), scanner.nextInt());
			for(int o = 0; o < f.m; o++) {
				f.tasks += (1<< (scanner.nextInt()-1));
			}
			friends.add(f);
		}
		Collections.sort(friends, new Comparator<Friend>() {
			@Override
			public int compare(Friend o1, Friend o2) {
				return - (int)(o1.k - o2.k);
			}
		});

		scanner.close();
		long[] result = new long[1<<m];
		Arrays.fill(result, Long.MAX_VALUE / 4);
		for(int i = 0; i < n; i++) {
			Friend f = friends.get(i);
			result[f.tasks] = Math.min(result[f.tasks], f.x + f.k * b);
			for(int o = 0; o < result.length; o++) {
				result[o|f.tasks] = Math.min(result[o|f.tasks], result[o] + f.x);
			}
		}
		if(result[result.length -1] == Long.MAX_VALUE / 4) {
			System.out.println("-1");
		} else {
			System.out.println(result[result.length-1]);
		}
	}

	static class Friend {
		long x;
		long k;
		int m;
		int tasks;
		public Friend(long x, long k, int m) {
			this.x = x;
			this.k = k;
			this.m = m;
		}
	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

/**
 * Created by Vadim_2 on 23.04.2014.
 */
public class Gena {
    private static class Friend implements Comparable{
        public long x;
        public long k;
        public int t;

        private Friend(long x, long k) {
            this.x = x;
            this.k = k;

        }

        @Override
        public int compareTo(Object o) {
            return Long.compare(this.k, ((Friend)o).k);
        }
    }
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(reader.readLine());

        int n = Integer.parseInt(st.nextToken());

        int m = Integer.parseInt(st.nextToken());

        long b = Integer.parseInt(st.nextToken());

        List<Friend> friends = new ArrayList<Friend>(n);

        for (int i = 0; i < n; i++) {
            st = new StringTokenizer(reader.readLine());
            long xi = Integer.parseInt(st.nextToken());
            long ki = Integer.parseInt(st.nextToken());
            int mi = Integer.parseInt(st.nextToken());
            Friend friend = new Friend(xi, ki);
            friends.add(friend);

            st = new StringTokenizer(reader.readLine());

            for (int j = 0; j < mi; j++) {
                int ntask = Integer.parseInt(st.nextToken());
                friend.t |= 1<<(ntask - 1);
            }
        }
        Collections.sort(friends);

        long[] d = new long[1<<m];
        long[] dp = new long[1<<m];

        Arrays.fill(dp, Long.MAX_VALUE);
        dp[0] = 0;

        for (Friend friend : friends) {
            for (int i = 0; i < 1 << m; i++) {
                if(dp[i] != Long.MAX_VALUE && i != (i|friend.t)) {
                    long np = d[i] +  friend.x;
                    long nv = np + friend.k * b;
                    if (nv < dp[i | friend.t]) {
                        dp[i | friend.t] = nv;
                        d[i | friend.t] = np;
                    }
                }
            }
        }
//        System.out.println(Arrays.toString(d));
//        System.out.println(Arrays.toString(dp));
        if(dp[(1<<m)-1] < Long.MAX_VALUE) {
            System.out.println(dp[(1<<m)-1]);
        } else {
            System.out.println(-1);
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

/**
 * Created by Vadim_2 on 23.04.2014.
 */
public class Gena {
    private static class Friend implements Comparable{
        public long x;
        public long k;
        public int t;

        private Friend(long x, long k) {
            this.x = x;
            this.k = k;

        }

        @Override
        public int compareTo(Object o) {
            return Long.compare(this.k, ((Friend)o).k);
        }
    }
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(reader.readLine());

        int n = Integer.parseInt(st.nextToken());

        int m = Integer.parseInt(st.nextToken());

        long b = Integer.parseInt(st.nextToken());

        List<Friend> friends = new ArrayList<Friend>(n);

        for (int i = 0; i < n; i++) {
            st = new StringTokenizer(reader.readLine());
            long xi = Integer.parseInt(st.nextToken());
            long ki = Integer.parseInt(st.nextToken());
            int mi = Integer.parseInt(st.nextToken());
            Friend friend = new Friend(xi, ki);
            friends.add(friend);

            st = new StringTokenizer(reader.readLine());

            for (int j = 0; j < mi; j++) {
                int ntask = Integer.parseInt(st.nextToken());
                friend.t |= 1<<(ntask - 1);
            }
        }
        Collections.sort(friends);

        long[] d = new long[1<<m];
        long[] dp = new long[1<<m];

        Arrays.fill(d, Long.MAX_VALUE);
        Arrays.fill(dp, Long.MAX_VALUE);
        d[0] = 0;
        dp[0] = 0;
        long minp = Long.MAX_VALUE;

        for (Friend friend : friends) {
            for (int i = 0; i < 1 << m; i++) {
                if(d[i] != Long.MAX_VALUE && i != (i|friend.t)) {
                    long np = d[i] +  friend.x;
                    if (np < d[i | friend.t]) {
                        d[i | friend.t] = np;
                    }
                }
            }
            if(d[(1<<m)-1] != Long.MAX_VALUE) {
                minp = Math.min(minp, d[(1<<m)-1] + friend.k*b);
            }

        }
//        System.out.println(Arrays.toString(d));
//        System.out.println(Arrays.toString(dp));
        if(minp < Long.MAX_VALUE) {
            System.out.println(minp);
        } else {
            System.out.println(-1);
        }
    }
}


package codestrike.r1;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

/**
 * Created by Vadim_2 on 23.04.2014.
 */
public class Gena {
    private static class Friend implements Comparable{
        public int x;
        public int k;
        public int m;
        public int t;

        private Friend(int x, int k, int m) {
            this.x = x;
            this.k = k;
            this.m = m;
        }

        @Override
        public int compareTo(Object o) {
            return this.m - ((Friend)o).m;
        }
    }
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(reader.readLine());

        int n = Integer.parseInt(st.nextToken());

        int m = Integer.parseInt(st.nextToken());

        long b = Integer.parseInt(st.nextToken());

        List<Friend> friends = new ArrayList<Friend>(n);

        for (int i = 0; i < n; i++) {
            st = new StringTokenizer(reader.readLine());
            int xi = Integer.parseInt(st.nextToken());
            int ki = Integer.parseInt(st.nextToken());
            int mi = Integer.parseInt(st.nextToken());
            Friend friend = new Friend(xi, ki, mi);
            friends.add(friend);

            st = new StringTokenizer(reader.readLine());

            for (int j = 0; j < mi; j++) {
                int ntask = Integer.parseInt(st.nextToken());
                friend.t |= 1<<(ntask - 1);
            }
        }
        Collections.sort(friends);//todo:??

        long[] d = new long[1<<m];
        long[] dp = new long[1<<m];

        Arrays.fill(dp, Long.MAX_VALUE);
        dp[0] = 0;

        for (Friend friend : friends) {
            for (int i = 0; i < 1 << m; i++) {
                if(dp[i] != Long.MAX_VALUE && i != (i|friend.t)) {
                    long np = d[i] + ((long) friend.x);
                    long nv = np + ((long) friend.k * b);
                    if (nv < dp[i | friend.t]) {
                        dp[i | friend.t] = nv;
                        d[i | friend.t] = np;
                    }
                }
            }
        }
//        System.out.println(Arrays.toString(d));
//        System.out.println(Arrays.toString(dp));
        if(dp[(1<<m)-1] < Long.MAX_VALUE) {
            System.out.println(dp[(1<<m)-1]);
        } else {
            System.out.println(-1);
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

/**
 * Created by Vadim_2 on 23.04.2014.
 */
public class Gena {
    private static class Friend implements Comparable{
        public int x;
        public int k;
        public int m;
        public int t;

        private Friend(int x, int k, int m) {
            this.x = x;
            this.k = k;
            this.m = m;
        }

        @Override
        public int compareTo(Object o) {
            return this.k - ((Friend)o).k;
        }
    }
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(reader.readLine());

        int n = Integer.parseInt(st.nextToken());

        int m = Integer.parseInt(st.nextToken());

        long b = Integer.parseInt(st.nextToken());

        List<Friend> friends = new ArrayList<Friend>(n);

        for (int i = 0; i < n; i++) {
            st = new StringTokenizer(reader.readLine());
            int xi = Integer.parseInt(st.nextToken());
            int ki = Integer.parseInt(st.nextToken());
            int mi = Integer.parseInt(st.nextToken());
            Friend friend = new Friend(xi, ki, mi);
            friends.add(friend);

            st = new StringTokenizer(reader.readLine());

            for (int j = 0; j < mi; j++) {
                int ntask = Integer.parseInt(st.nextToken());
                friend.t |= 1<<(ntask - 1);
            }
        }
        Collections.sort(friends);

        long[] d = new long[1<<m];
        long[] dp = new long[1<<m];

        Arrays.fill(dp, Long.MAX_VALUE);
        dp[0] = 0;

        for (Friend friend : friends) {
            for (int i = 0; i < 1 << m; i++) {
                if(dp[i] != Long.MAX_VALUE && i != (i|friend.t)) {
                    long np = d[i] + ((long) friend.x);
                    long nv = np + ((long) friend.k * b);
                    if (nv < dp[i | friend.t]) {
                        dp[i | friend.t] = nv;
                        d[i | friend.t] = np;
                    }
                }
            }
        }
//        System.out.println(Arrays.toString(d));
//        System.out.println(Arrays.toString(dp));
        if(dp[(1<<m)-1] < Long.MAX_VALUE) {
            System.out.println(dp[(1<<m)-1]);
        } else {
            System.out.println(-1);
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

/**
 * Created by Vadim_2 on 23.04.2014.
 */
public class Gena {
    private static class Friend implements Comparable{
        public int x;
        public int k;
        public int m;
        public int t;

        private Friend(int x, int k, int m) {
            this.x = x;
            this.k = k;
            this.m = m;
        }

        @Override
        public int compareTo(Object o) {
            return this.k - ((Friend)o).k;
        }
    }
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(reader.readLine());

        int n = Integer.parseInt(st.nextToken());

        int m = Integer.parseInt(st.nextToken());

        long b = Integer.parseInt(st.nextToken());

        List<Friend> friends = new ArrayList<Friend>(n);

        for (int i = 0; i < n; i++) {
            st = new StringTokenizer(reader.readLine());
            int xi = Integer.parseInt(st.nextToken());
            int ki = Integer.parseInt(st.nextToken());
            int mi = Integer.parseInt(st.nextToken());
            Friend friend = new Friend(xi, ki, mi);
            friends.add(friend);

            st = new StringTokenizer(reader.readLine());

            for (int j = 0; j < mi; j++) {
                int ntask = Integer.parseInt(st.nextToken());
                friend.t |= 1<<(ntask - 1);
            }
        }
        Collections.sort(friends);

        long[] d = new long[1<<m];
        long[] dp = new long[1<<m];

        Arrays.fill(dp, Long.MAX_VALUE);
        dp[0] = 0;

        for (Friend friend : friends) {
            for (int i = 0; i < 1 << m; i++) {
                if(dp[i] != Long.MAX_VALUE && i != (i|friend.t)) {
                    long np = d[i] + ((long) friend.x);
                    long nv = np + ((long) friend.k * b);
                    if (nv < dp[i | friend.t]) {
                        dp[i | friend.t] = nv;
                        d[i | friend.t] = np;
                    }
                }
            }
        }
//        System.out.println(Arrays.toString(d));
//        System.out.println(Arrays.toString(dp));
        if(dp[(1<<m)-1] < Long.MAX_VALUE) {
            System.out.println(dp[(1<<m)-1]);
        } else {
            System.out.println(-1);
        }
    }


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

/**
 * Created by Vadim_2 on 23.04.2014.
 */
public class Gena {
    private static class Friend implements Comparable{
        public int x;
        public int k;
        public int m;
        public int t;

        private Friend(int x, int k, int m) {
            this.x = x;
            this.k = k;
            this.m = m;
        }

        @Override
        public int compareTo(Object o) {
            return this.m - ((Friend)o).m;
        }
    }
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(reader.readLine());

        int n = Integer.parseInt(st.nextToken());

        int m = Integer.parseInt(st.nextToken());

        long b = Integer.parseInt(st.nextToken());

        List<Friend> friends = new ArrayList<Friend>(n);

        for (int i = 0; i < n; i++) {
            st = new StringTokenizer(reader.readLine());
            int xi = Integer.parseInt(st.nextToken());
            int ki = Integer.parseInt(st.nextToken());
            int mi = Integer.parseInt(st.nextToken());
            Friend friend = new Friend(xi, ki, mi);
            friends.add(friend);

            st = new StringTokenizer(reader.readLine());

            for (int j = 0; j < mi; j++) {
                int ntask = Integer.parseInt(st.nextToken());
                friend.t |= 1<<(ntask - 1);
            }
        }
        Collections.sort(friends);//todo:??

        long[] d = new long[1<<m];
        long[] dp = new long[1<<m];

        Arrays.fill(dp, Long.MAX_VALUE);
        dp[0] = 0;

        for (Friend friend : friends) {
            for (int i = 0; i < 1 << m; i++) {
                if(dp[i] != Long.MAX_VALUE && i != (i|friend.t)) {
                    long np = d[i] + ((long) friend.x);
                    long nv = np + ((long) friend.k * b);
                    if (nv < dp[i | friend.t]) {
                        dp[i | friend.t] = nv;
                        d[i | friend.t] = np;
                    }
                }
            }
        }
//        System.out.println(Arrays.toString(d));
//        System.out.println(Arrays.toString(dp));
        if(dp[(1<<m)-1] < Long.MAX_VALUE) {
            System.out.println(dp[(1<<m)-1]);
        } else {
            System.out.println(-1);
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

/**
 * Created by Vadim_2 on 23.04.2014.
 */
public class Gena {
    private static class Friend implements Comparable{
        public int x;
        public int k;
        public int m;
        public int t;

        private Friend(int x, int k, int m) {
            this.x = x;
            this.k = k;
            this.m = m;
        }

        @Override
        public int compareTo(Object o) {
            return this.k - ((Friend)o).k;
        }
    }
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(reader.readLine());

        int n = Integer.parseInt(st.nextToken());

        int m = Integer.parseInt(st.nextToken());

        long b = Integer.parseInt(st.nextToken());

        List<Friend> friends = new ArrayList<Friend>(n);

        for (int i = 0; i < n; i++) {
            st = new StringTokenizer(reader.readLine());
            int xi = Integer.parseInt(st.nextToken());
            int ki = Integer.parseInt(st.nextToken());
            int mi = Integer.parseInt(st.nextToken());
            Friend friend = new Friend(xi, ki, mi);
            friends.add(friend);

            st = new StringTokenizer(reader.readLine());

            for (int j = 0; j < mi; j++) {
                int ntask = Integer.parseInt(st.nextToken());
                friend.t |= 1<<(ntask - 1);
            }
        }
        Collections.sort(friends);

        long[] d = new long[1<<m];
        long[] dp = new long[1<<m];

        Arrays.fill(dp, Long.MAX_VALUE);
        dp[0] = 0;

        for (Friend friend : friends) {
            for (int i = 0; i < 1 << m; i++) {
                if(dp[i] != Long.MAX_VALUE && i != (i|friend.t)) {
                    long np = d[i] + ((long) friend.x);
                    long nv = np + ((long) friend.k) * b;
                    if (nv < dp[i | friend.t]) {
                        dp[i | friend.t] = nv;
                        d[i | friend.t] = np;
                    }
                }
            }
        }
//        System.out.println(Arrays.toString(d));
//        System.out.println(Arrays.toString(dp));
        if(dp[(1<<m)-1] < Long.MAX_VALUE) {
            System.out.println(dp[(1<<m)-1]);
        } else {
            System.out.println(-1);
        }
    }
}


import java.io.*;
import java.util.Arrays;
import java.util.Comparator;
import java.util.StringTokenizer;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    InputReader in = new InputReader(inputStream);
    PrintWriter out = new PrintWriter(outputStream);
    Task solver = new Task();
    solver.solve(1, in, out);
    out.close();
  }
}

class Task {
  int n;
  int m;
  long b;
  int[] needMoney;
  int[] needMonitors;
  int[] canSolve;

  long solveWithDP(Integer[] order) {
    long[] dp = new long[1 << m];
    int cur = 0, nxt = 1;
    Arrays.fill(dp, -1);
    dp[0] = 0;
    long answer = Long.MAX_VALUE;
    for (int it = 0; it < n; it++) {
      int v = order[it];
      for (int i = 0; i < dp.length; i++) {
        if (dp[i] != -1) {
          int i2 = i | canSolve[v];
          if (dp[i2] == -1 || dp[i2] > dp[i] + needMoney[v]) {
            dp[i2] = dp[i] + needMoney[v];
          }
        }
      }
      long curAns = dp[(1 << m) - 1];
      if (curAns == -1) {
        curAns = Long.MAX_VALUE;
      } else {
        curAns += b * needMonitors[v];
      }
      answer = Math.min(answer, curAns);
      int t = cur;
      cur = nxt;
      nxt = t;
    }
    if (answer == Long.MAX_VALUE) {
      answer = -1;
    }
    return answer;
  }

  public void solve(int testNumber, InputReader in, PrintWriter out) {
    n = in.nextInt();
    m = in.nextInt();
    b = in.nextInt();
    needMoney = new int[n];
    needMonitors = new int[n];
    canSolve = new int[n];
    Integer[] order = new Integer[n];
    for (int i = 0; i < n; i++) {
      needMoney[i] = in.nextInt();
      needMonitors[i] = in.nextInt();
      int nt = in.nextInt();
      for (int j = 0; j < nt; j++) {
        int pos = in.nextInt() - 1;
        canSolve[i] |= (1 << pos);
      }
      order[i] = i;
    }
    Arrays.sort(order, new Comparator<Integer>() {
      @Override
      public int compare(Integer o1, Integer o2) {
        return needMonitors[o1] - needMonitors[o2];
      }
    });
    out.println(solveWithDP(order));
  }
}

class InputReader {
  private BufferedReader reader;
  private StringTokenizer tokenizer;

  public InputReader(InputStream stream) {
    reader = new BufferedReader(new InputStreamReader(stream));
    tokenizer = null;
  }

  public int nextInt() {
    return Integer.parseInt(next());
  }

  public String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new StringTokenizer(reader.readLine());
      } catch (IOException e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }
}


import java.io.*;
import java.util.Arrays;
import java.util.Comparator;
import java.util.StringTokenizer;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    InputReader in = new InputReader(inputStream);
    PrintWriter out = new PrintWriter(outputStream);
    Task solver = new Task();
    solver.solve(1, in, out);
    out.close();
  }
}

class Task {
  int n;
  int m;
  long b;
  int[] needMoney;
  int[] needMonitors;
  int[] canSolve;

  long solveWithDP(Integer[] order) {
    long[][] dp = new long[2][1 << m];
    int cur = 0, nxt = 1;
    Arrays.fill(dp[0], -1);
    dp[0][0] = 0;
    long answer = Long.MAX_VALUE;
    for (int it = 0; it < n; it++) {
      System.arraycopy(dp[cur], 0, dp[nxt], 0, dp[cur].length);
      int v = order[it];
      for (int i = 0; i < dp[cur].length; i++) {
        if (dp[cur][i] != -1) {
          int i2 = i | canSolve[v];
          if (dp[nxt][i2] == -1 || dp[nxt][i2] > dp[cur][i] + needMoney[v]) {
            dp[nxt][i2] = dp[cur][i] + needMoney[v];
          }
        }
      }
      long curAns = dp[nxt][(1 << m) - 1];
      if (curAns == -1) {
        curAns = Long.MAX_VALUE;
      } else {
        curAns += b * needMonitors[v];
      }
      answer = Math.min(answer, curAns);
      int t = cur;
      cur = nxt;
      nxt = t;
    }
    if (answer == Long.MAX_VALUE) {
      answer = -1;
    }
    return answer;
  }

  public void solve(int testNumber, InputReader in, PrintWriter out) {
    n = in.nextInt();
    m = in.nextInt();
    b = in.nextInt();
    needMoney = new int[n];
    needMonitors = new int[n];
    canSolve = new int[n];
    Integer[] order = new Integer[n];
    for (int i = 0; i < n; i++) {
      needMoney[i] = in.nextInt();
      needMonitors[i] = in.nextInt();
      int nt = in.nextInt();
      for (int j = 0; j < nt; j++) {
        int pos = in.nextInt() - 1;
        canSolve[i] |= (1 << pos);
      }
      order[i] = i;
    }
    Arrays.sort(order, new Comparator<Integer>() {
      @Override
      public int compare(Integer o1, Integer o2) {
        return needMonitors[o1] - needMonitors[o2];
      }
    });
    out.println(solveWithDP(order));
  }
}

class InputReader {
  private BufferedReader reader;
  private StringTokenizer tokenizer;

  public InputReader(InputStream stream) {
    reader = new BufferedReader(new InputStreamReader(stream));
    tokenizer = null;
  }

  public int nextInt() {
    return Integer.parseInt(next());
  }

  public String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new StringTokenizer(reader.readLine());
      } catch (IOException e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }
}


#include<cstdio>
#include<iostream>
#include<stdlib.h>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;

struct node{
	int fe,bo,nu;
};

bool cmp(node a,node b){
	return a.bo<b.bo;
}

int main(){
	long long ans=2000000000000000000,f[100][1200000];
	int i,j,flag=0,n,m,mm,tt,b,g[30];
	node a[200];
	g[1]=1; for (i=2;i<=20;i++) g[i]=g[i-1]*2;

	cin>>n>>m>>b;
	for (i=1;i<=n;i++){
		cin>>a[i].fe>>a[i].bo>>mm;
		a[i].nu=0;
		for (j=1;j<=mm;j++){
			cin>>tt;
			a[i].nu+=g[tt];
		}
	}
	for (i=1;i<=20;i++) {g[i]+=g[i-1]; }

	sort(a+1,a+n+1,cmp);

	for (j=1;j<=g[m];j++) f[0][j]=ans;
	f[0][0]=0;
	for (i=1;i<=n;i++){
		for (j=0;j<=g[m];j++) f[i][j]=f[i-1][j];
		for (j=0;j<=g[m];j++){
			if (f[i][j|a[i].nu]>f[i-1][j]+a[i].fe)
				f[i][j|a[i].nu]=f[i-1][j]+a[i].fe;
		}
		if (f[i][g[m]]+a[i].bo*b<ans){
			ans=f[i][g[m]]+a[i].bo*b;
			flag=1;
		}
	}
	if (flag) cout<<ans;
	else cout<<-1;
}


#include<cstdio>
#include<iostream>
#include<stdlib.h>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;

struct node{
	int fe,bo,nu;
};

bool cmp(node a,node b){
	return a.bo<b.bo;
}

int main(){
	long long ans=2000000000000000000,g[30],f[2000000];
	int i,j,flag=0,n,m,mm,tt,b;
	node a[200];
	g[1]=1; for (i=2;i<=20;i++) g[i]=g[i-1]*2;

	cin>>n>>m>>b;
	for (i=1;i<=n;i++){
		cin>>a[i].fe>>a[i].bo>>mm;
		a[i].nu=0;
		for (j=1;j<=mm;j++){
			cin>>tt;
			a[i].nu+=g[tt];
		}
	}
	for (i=1;i<=20;i++) {g[i]+=g[i-1]; }

	sort(a+1,a+n+1,cmp);

	for (j=1;j<=g[m];j++) f[j]=ans;
	f[0]=0;
	for (i=1;i<=n;i++){
		for (j=0;j<=g[m];j++){
			if (f[j|a[i].nu]>f[j]+a[i].fe)
				f[j|a[i].nu]=f[j]+a[i].fe;
		}
		if (f[g[m]]+a[i].bo*b<ans){
			ans=f[g[m]]+a[i].bo*b;
			flag=1;
		}
	}
	if (flag) cout<<ans;
	else cout<<-1;
}


#include<cstdio>
#include<iostream>
#include<stdlib.h>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;

struct node{
	int fe,bo,nu;
};

bool cmp(node a,node b){
	return a.bo<b.bo;
}

int main(){
	long long ans=2000000000000000000,f[1200000];
	int i,j,flag=0,n,m,mm,tt,b,g[30];
	node a[200];
	g[1]=1; for (i=2;i<=20;i++) g[i]=g[i-1]*2;

	cin>>n>>m>>b;
	for (i=1;i<=n;i++){
		cin>>a[i].fe>>a[i].bo>>mm;
		a[i].nu=0;
		for (j=1;j<=mm;j++){
			cin>>tt;
			a[i].nu+=g[tt];
		}
	}
	for (i=1;i<=20;i++) {g[i]+=g[i-1]; }

	sort(a+1,a+n+1,cmp);

	for (j=1;j<=g[m];j++) f[j]=ans;
	f[0]=0;
	for (i=1;i<=n;i++){
		for (j=0;j<=g[m];j++){
			if (f[j|a[i].nu]>f[j]+a[i].fe)
				f[j|a[i].nu]=f[j]+a[i].fe;
		}
		if (f[g[m]]+a[i].bo*b<ans){
			ans=f[g[m]]+a[i].bo*b;
			flag=1;
		}
	}
	if (flag) cout<<ans;
	else cout<<-1;
}


#include<cstdio>
#include<iostream>
#include<stdlib.h>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;

struct node{
	long long fe,bo,nu;
};

bool cmp(node a,node b){
	return a.bo<b.bo;
}

int main(){
	long long ans=2000000000000000000,g[30],f[2000000];
	int i,j,flag=0,n,m,mm,tt,b;
	node a[200];
	g[1]=1; for (i=2;i<=20;i++) g[i]=g[i-1]*2;

	cin>>n>>m>>b;
	for (i=1;i<=n;i++){
		cin>>a[i].fe>>a[i].bo>>mm;
		a[i].nu=0;
		for (j=1;j<=mm;j++){
			cin>>tt;
			a[i].nu+=g[tt];
		}
	}
	for (i=1;i<=20;i++) {g[i]+=g[i-1]; }

	sort(a+1,a+n+1,cmp);

	for (j=1;j<=g[m];j++) f[j]=ans;
	f[0]=0;
	for (i=1;i<=n;i++){
		for (j=0;j<=g[m];j++){
			if (f[j|a[i].nu]>f[j]+a[i].fe)
				f[j|a[i].nu]=f[j]+a[i].fe;
		}
		if (f[g[m]]+a[i].bo*b<ans){
			ans=f[g[m]]+a[i].bo*b;
			flag=1;
		}
	}
	if (flag) cout<<ans;
	else cout<<-1;
}


#include<bits/stdc++.h>
using namespace std;
#define INF 1000000001000000000LL
#define u unsigned
u long long n,m,k;
vector<int>prob[105];
u long long  dp[1<<21];
struct node
{
	u long long cost;
	u long long monitors;
	u long long probs;
	u long long mask;
}friends[105];
bool cmp(node a,node b)
{
	return a.monitors < b.monitors;
}
u long long func(int mask,int i,int prev)
{
	if(mask==((1<<m)-1))
		return 0;
	if(i==0 && mask !=((1<<m)-1))
		return INF;
	if(dp[mask]!=-1)
		return dp[mask];
	u long long l=func(mask,i-1,prev);
	int newmask=friends[i].mask | mask;
	int nextprev=prev;
	u long long r=func(newmask,i-1,nextprev)+friends[i].cost;
	return dp[mask]=min(l,r);
}
int main()
{
	memset(dp,-1,sizeof(dp));
	scanf("%lld %lld %lld",&n,&m,&k);
	//friends.push_back(make_pair(0,make_pair(0,0)));
	for(int i=1;i<=n;i++)
	{
		u long long int a,b,c;
		scanf("%lld %lld %lld",&a,&b,&c);
		friends[i].cost=a;
		friends[i].monitors=b;
		friends[i].probs=c;
		int mask=0;
		for(int j=0;j<c;j++)
		{
			int x;
			scanf("%d",&x);
			x--;
			mask=mask|(1<<x);
		}
		friends[i].mask=mask;
	}
	sort(friends+1,friends+n+1,cmp);
	u long long ans=INF;
	for(int i=1;i<=n;i++)
	{
		int mask=friends[i].mask;
		u long long ff=func(mask,i-1,0);
		if(ff<INF)
			ans=min(ans,func(mask,i-1,0)+friends[i].monitors * k+friends[i].cost);
	}
	if(ans==INF)
		ans=-1;
	printf("%lld\n",ans );
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define INF (1LL<<60)
long long n,m,k;
long long  dp[1<<21];
struct node
{
	  long long cost;
	  long long monitors;
	  long long probs;
	  long long mask;
}friends[105];
bool cmp(node a,node b)
{
	return a.monitors < b.monitors;
}
long long func(long long  mask,int i)
{
	if(i==0)
	{
		if(mask==((1<<m)-1))
			return 0;
		return INF;
	}
	if(dp[mask]!=-1)
		return dp[mask];
	  long long l=func(mask,i-1);
	long long  newmask=friends[i].mask | mask;
	long long ff=func(newmask,i-1);
	  if(ff<INF)
	  		ff+=friends[i].cost;
	  long long r=ff;
	  if(mask==0)
	  	r+=friends[i].monitors*k;
	return dp[mask]=min(l,r);
}
int main()
{
	memset(dp,-1,sizeof(dp));
	//dp[0]=0;
	scanf("%lld %lld %lld",&n,&m,&k);
	//friends.p sh_back(make_pair(0,make_pair(0,0)));
	for(int i=1;i<=n;i++)
	{
		  long long int a,b,c;
		scanf("%lld %lld %lld",&a,&b,&c);
		friends[i].cost=a;
		friends[i].monitors=b;
		friends[i].probs=c;
		long long mask=0;
		for(int j=0;j<c;j++)
		{
			long long int x;
			scanf("%lld",&x);
			x--;
			mask=mask|(1<<x);
		}
		friends[i].mask=mask;
	}
	sort(friends,friends+n+1,cmp);
	  long long ans=func(0,n);
	/*for(int i=1;i<=n;i++)
	{
		long long int mask=friends[i].mask;
		  long long ff=func(mask,i-1);
		if(ff<INF)
			ans=min(ans,ff+friends[i].monitors * k+friends[i].cost);
	}*/
	if(ans>=INF)
		ans=-1;
	printf("%lld\n",ans );
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define INF (1LL<<60)
long long n,m,k;
long long  dp[1<<21];
struct node
{
	  long long cost;
	  long long monitors;
	  long long probs;
	  long long mask;
}friends[105];
bool cmp(node a,node b)
{
	return a.monitors < b.monitors;
}
long long func(long long  mask,int i)
{
	if(mask==((1<<m)-1))
		return 0;
	if(i==0)
		return INF;
	if(dp[mask]!=-1)
		return dp[mask];
	  long long l=func(mask,i-1);
	long long  newmask=friends[i].mask | mask;
	long long ff=func(newmask,i-1);
	  if(ff<INF)
	  		ff+=friends[i].cost;
	  long long r=ff;
	return dp[mask]=min(l,r);
}
int main()
{
	memset(dp,-1,sizeof(dp));
	dp[0]=0;
	scanf("%lld %lld %lld",&n,&m,&k);
	//friends.p sh_back(make_pair(0,make_pair(0,0)));
	for(int i=1;i<=n;i++)
	{
		  long long int a,b,c;
		scanf("%lld %lld %lld",&a,&b,&c);
		friends[i].cost=a;
		friends[i].monitors=b;
		friends[i].probs=c;
		long long mask=0;
		for(int j=0;j<c;j++)
		{
			long long int x;
			scanf("%lld",&x);
			x--;
			mask=mask|(1<<x);
		}
		friends[i].mask=mask;
	}
	sort(friends,friends+n+1,cmp);
	  long long ans=INF;
	for(int i=1;i<=n;i++)
	{
		long long int mask=friends[i].mask;
		  long long ff=func(mask,i-1);
		if(ff<INF)
			ans=min(ans,ff+friends[i].monitors * k+friends[i].cost);
	}
	if(ans>=INF)
		ans=-1;
	printf("%lld\n",ans );
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define INF 1000000000000000000LL
long long n,m,k;
long long  friends[105][3];
vector<int>prob[105];
long long  dp[105][1<<18];
long long func(int mask,int i,int prev)
{
	if(mask==((1<<m)-1))
		return 0;
	if(i==n+1 && mask !=((1<<m)-1))
		return INF;
	if(dp[prev][mask]!=-1)
		return dp[prev][mask];
	long long l=func(mask,i+1,prev);
	int newmask=mask;
	for(int j=0;j<prob[i].size();j++)
	{
		newmask=newmask |  (1<<prob[i][j]);
	}
	long long moncost=0;
	if(friends[i][1] > friends[prev][1])
	{
		moncost=(friends[i][1]-friends[prev][1])*k;
	}
	int nextprev=prev;
	if(moncost>0)
		nextprev=i;
	long long r=func(newmask,i+1,nextprev)+friends[i][0]+moncost;
	return dp[prev][mask]=min(l,r);
}
int main()
{
	memset(dp,-1,sizeof(dp));
	scanf("%lld %lld %lld",&n,&m,&k);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld %lld %lld",&friends[i][0],&friends[i][1],&friends[i][2]);
		for(int j=0;j<friends[i][2];j++)
		{
			int x;
			scanf("%d",&x);
			x--;
			prob[i].push_back(x);
		}
	}
	long long ans=func(0,1,0);
	if(ans==INF)
		ans=-1;
	printf("%lld\n",ans );
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define INF 9223372036854775807LL
long long n,m,k;
long long  dp[1<<21];
struct node
{
	  long long cost;
	  long long monitors;
	  long long probs;
	  long long mask;
}friends[105];
bool cmp(node a,node b)
{
	return a.monitors < b.monitors;
}
long long func(long long  mask,int i)
{
	if(mask==((1<<m)-1))
		return 0;
	if(i==0)
		return INF;
	if(dp[mask]!=-1)
		return dp[mask];
	  long long l=func(mask,i-1);
	long long  newmask=friends[i].mask | mask;
	long long ff=func(newmask,i-1);
	  if(ff<INF)
	  		ff+=friends[i].cost;
	  long long r=ff;
	return dp[mask]=min(l,r);
}
int main()
{
	memset(dp,-1,sizeof(dp));
	scanf("%lld %lld %lld",&n,&m,&k);
	//friends.p sh_back(make_pair(0,make_pair(0,0)));
	for(int i=1;i<=n;i++)
	{
		  long long int a,b,c;
		scanf("%lld %lld %lld",&a,&b,&c);
		friends[i].cost=a;
		friends[i].monitors=b;
		friends[i].probs=c;
		long long mask=0;
		for(int j=0;j<c;j++)
		{
			long long int x;
			scanf("%lld",&x);
			x--;
			mask=mask|(1<<x);
		}
		friends[i].mask=mask;
	}
	sort(friends,friends+n+1,cmp);
	  long long ans=INF;
	for(int i=1;i<=n;i++)
	{
		long long int mask=friends[i].mask;
		  long long ff=func(mask,i-1);
		if(ff<INF)
			ans=min(ans,ff+friends[i].monitors * k+friends[i].cost);
	}
	if(ans>=INF)
		ans=-1;
	printf("%lld\n",ans );
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define INF 1000000000000000000LL
long long n,m,k;
long long  friends[105][3];
vector<int>prob[105];
long long  dp[105][1<<21];
long long func(int mask,int i,int prev)
{
	if(mask==((1<<m)-1))
		return 0;
	if(i==n+1 && mask !=((1<<m)-1))
		return INF;
	if(dp[prev][mask]!=-1)
		return dp[prev][mask];
	long long l=func(mask,i+1,prev);
	int newmask=mask;
	for(int j=0;j<prob[i].size();j++)
	{
		newmask=newmask |  (1<<prob[i][j]);
	}
	long long moncost=0;
	if(friends[i][1] > friends[prev][1])
	{
		moncost=(friends[i][1]-friends[prev][1])*k;
	}
	int nextprev=prev;
	if(moncost>0)
		nextprev=i;
	long long r=func(newmask,i+1,nextprev)+friends[i][0]+moncost;
	return dp[prev][mask]=min(l,r);
}
int main()
{
	memset(dp,-1,sizeof(dp));
	scanf("%lld %lld %lld",&n,&m,&k);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld %lld %lld",&friends[i][0],&friends[i][1],&friends[i][2]);
		for(int j=0;j<friends[i][2];j++)
		{
			int x;
			scanf("%d",&x);
			x--;
			prob[i].push_back(x);
		}
	}
	long long ans=func(0,1,0);
	if(ans==INF)
		ans=-1;
	printf("%lld\n",ans );
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define INF 9223372036854775807LL
long long n,m,k;
long long  dp[1<<21];
struct node
{
	  long long cost;
	  long long monitors;
	  long long probs;
	  long long mask;
}friends[105];
bool cmp(node a,node b)
{
	return a.monitors < b.monitors;
}
long long func(long long  mask,int i)
{
	if(mask==((1<<m)-1))
		return 0;
	if(i==0)
		return INF;
	if(dp[mask]!=-1)
		return dp[mask];
	  long long l=func(mask,i-1);
	long long  newmask=friends[i].mask | mask;
	long long ff=func(newmask,i-1);
	  if(ff<INF)
	  		ff+=friends[i].cost;
	  long long r=ff;
	return dp[mask]=min(l,r);
}
int main()
{
	memset(dp,-1,sizeof(dp));
	dp[0]=0;
	scanf("%lld %lld %lld",&n,&m,&k);
	//friends.p sh_back(make_pair(0,make_pair(0,0)));
	for(int i=1;i<=n;i++)
	{
		  long long int a,b,c;
		scanf("%lld %lld %lld",&a,&b,&c);
		friends[i].cost=a;
		friends[i].monitors=b;
		friends[i].probs=c;
		long long mask=0;
		for(int j=0;j<c;j++)
		{
			long long int x;
			scanf("%lld",&x);
			x--;
			mask=mask|(1<<x);
		}
		friends[i].mask=mask;
	}
	sort(friends,friends+n+1,cmp);
	  long long ans=INF;
	for(int i=1;i<=n;i++)
	{
		long long int mask=friends[i].mask;
		  long long ff=func(mask,i-1);
		if(ff<INF)
			ans=min(ans,ff+friends[i].monitors * k+friends[i].cost);
	}
	if(ans>=INF)
		ans=-1;
	printf("%lld\n",ans );
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define INF 1000000000000000000LL
long long n,m,k;
vector<int>prob[105];
long long  dp[1<<21];
struct node
{
	long long cost;
	long long monitors;
	long long probs;
	long long mask;
}friends[105];
bool cmp(node a,node b)
{
	return a.monitors < b.monitors;
}
long long func(int mask,int i,int prev)
{
	if(mask==((1<<m)-1))
		return 0;
	if(i==0 && mask !=((1<<m)-1))
		return INF;
	if(dp[mask]!=-1)
		return dp[mask];
	long long l=func(mask,i-1,prev);
	int newmask=friends[i].mask | mask;
	int nextprev=prev;
	long long r=func(newmask,i-1,nextprev)+friends[i].cost;
	return dp[mask]=min(l,r);
}
int main()
{
	memset(dp,-1,sizeof(dp));
	scanf("%lld %lld %lld",&n,&m,&k);
	//friends.push_back(make_pair(0,make_pair(0,0)));
	for(int i=1;i<=n;i++)
	{
		long long int a,b,c;
		scanf("%lld %lld %lld",&a,&b,&c);
		friends[i].cost=a;
		friends[i].monitors=b;
		friends[i].probs=c;
		int mask=0;
		for(int j=0;j<c;j++)
		{
			int x;
			scanf("%d",&x);
			x--;
			mask=mask|(1<<x);
		}
		friends[i].mask=mask;
	}
	sort(friends+1,friends+n+1,cmp);
	long long ans=INF;
	for(int i=1;i<=n;i++)
	{
		int mask=friends[i].mask;
		ans=min(ans,func(mask,i-1,0)+friends[i].monitors * k+friends[i].cost);
	}
	if(ans==INF)
		ans=-1;
	printf("%lld\n",ans );
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define INF (1LL<<60)
long long n,m,k;
long long  dp[1<<21];
struct node
{
	  long long cost;
	  long long monitors;
	  long long probs;
	  long long mask;
}friends[105];
bool cmp(node a,node b)
{
	return a.monitors < b.monitors;
}
long long func(long long  mask,int i)
{
	if(i==0)
	{
		if(mask==((1<<m)-1))
			return 0;
		return INF;
	}
	if(dp[mask]!=-1 && dp[mask]!=INF)
		return dp[mask];
	  long long l=func(mask,i-1);
	long long  newmask=friends[i].mask | mask;
	long long ff=func(newmask,i-1);
	  if(ff<INF)
	  		ff+=friends[i].cost;
	  long long r=ff;
	return dp[mask]=min(l,r);
}
int main()
{
	memset(dp,-1,sizeof(dp));
	scanf("%lld %lld %lld",&n,&m,&k);
	for(int i=1;i<=n;i++)
	{
		 long long int a,b,c;
		scanf("%lld %lld %lld",&a,&b,&c);
		friends[i].cost=a;
		friends[i].monitors=b;
		friends[i].probs=c;
		long long mask=0;
		for(int j=0;j<c;j++)
		{
			long long int x;
			scanf("%lld",&x);
			x--;
			mask=mask|(1<<x);
		}
		friends[i].mask=mask;
	}
	sort(friends,friends+n+1,cmp);
	  long long ans=INF;
	for(int i=1;i<=n;i++)
	{
		long long int mask=friends[i].mask;
		  long long ff=func(mask,i-1);
		if(ff<INF)
			ans=min(ans,ff+friends[i].monitors * k+friends[i].cost);
	}
	if(ans>=INF)
		ans=-1;
	printf("%lld\n",ans );
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define INF 1000000000000000000LL
long long n,m,k;
long long  friends[105][3];
vector<int>prob[105];
long long  dp[101][1<<20];
long long func(int mask,int i,int prev)
{
	if(mask==((1<<m)-1))
		return 0;
	if(i==n+1 && mask !=((1<<m)-1))
		return INF;
	if(dp[prev][mask]!=-1)
		return dp[prev][mask];
	long long l=func(mask,i+1,prev);
	int newmask=mask;
	for(int j=0;j<prob[i].size();j++)
	{
		newmask=newmask |  (1<<prob[i][j]);
	}
	long long moncost=0;
	if(friends[i][1] > friends[prev][1])
	{
		moncost=(friends[i][1]-friends[prev][1])*k;
	}
	int nextprev=prev;
	if(moncost>0)
		nextprev=i;
	long long r=func(newmask,i+1,nextprev)+friends[i][0]+moncost;
	return dp[prev][mask]=min(l,r);
}
int main()
{
	memset(dp,-1,sizeof(dp));
	scanf("%lld %lld %lld",&n,&m,&k);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld %lld %lld",&friends[i][0],&friends[i][1],&friends[i][2]);
		for(int j=0;j<friends[i][2];j++)
		{
			int x;
			scanf("%d",&x);
			x--;
			prob[i].push_back(x);
		}
	}
	long long ans=func(0,1,0);
	if(ans==INF)
		ans=-1;
	printf("%lld\n",ans );
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define INF (1LL<<60)
long long n,m,k;
long long  dp[1<<21];
struct node
{
	  long long cost;
	  long long monitors;
	  long long probs;
	  long long mask;
}friends[105];
bool cmp(node a,node b)
{
	return a.monitors < b.monitors;
}
long long func(long long  mask,int i)
{
	if(i==0)
	{
		if(mask==((1<<m)-1))
			return 0;
		return INF;
	}
	if(dp[mask]!=-1)
		return dp[mask];
	long long l=func(mask,i-1);
	long long  newmask=(friends[i].mask | mask);
	long long ff=func(newmask,i-1);
	  if(ff<INF)
	  		ff+=friends[i].cost;
	long long r=ff;
	return dp[mask]=min(l,r);
}
int main()
{
	memset(dp,-1,sizeof(dp));
	//dp[0]=0;
	scanf("%lld %lld %lld",&n,&m,&k);
	//friends.p sh_back(make_pair(0,make_pair(0,0)));
	for(int i=1;i<=n;i++)
	{
		  long long int a,b,c;
		scanf("%lld %lld %lld",&a,&b,&c);
		friends[i].cost=a;
		friends[i].monitors=b;
		friends[i].probs=c;
		long long mask=0;
		for(int j=0;j<c;j++)
		{
			long long int x;
			scanf("%lld",&x);
			x--;
			mask=(mask|(1<<x));
		}
		friends[i].mask=mask;
	}
	sort(friends,friends+n+1,cmp);
	long long ans = INF;
	for(int i = 1;i<=n; i++){
		memset(dp,-1,sizeof(dp));
		ans = min(ans, func(friends[i].mask,i-1) + friends[i].monitors*k +friends[i].cost);
	}
	/*for(int i=1;i<=n;i++)
	{
		long long int mask=friends[i].mask;
		  long long ff=func(mask,i-1);
		if(ff<INF)
			ans=min(ans,ff+friends[i].monitors * k+friends[i].cost);
	}*/
	if(ans>=INF)
		ans=-1;
	printf("%lld\n",ans );
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define INF 9223372036854775807LL
#define u unsigned
u long long n,m,k;
vector<int>prob[105];
u long long  dp[1<<21];
struct node
{
	u long long cost;
	u long long monitors;
	u long long probs;
	u long long mask;
}friends[105];
bool cmp(node a,node b)
{
	return a.monitors < b.monitors;
}
u long long func(int mask,int i,int prev)
{
	if(mask==((1<<m)-1))
		return 0;
	if(i==0 && mask !=((1<<m)-1))
		return INF;
	if(dp[mask]!=-1)
		return dp[mask];
	u long long l=func(mask,i-1,prev);
	int newmask=friends[i].mask | mask;
	int nextprev=prev;
	u long long r=func(newmask,i-1,nextprev)+friends[i].cost;
	return dp[mask]=min(l,r);
}
int main()
{
	memset(dp,-1,sizeof(dp));
	scanf("%lld %lld %lld",&n,&m,&k);
	//friends.push_back(make_pair(0,make_pair(0,0)));
	for(int i=1;i<=n;i++)
	{
		u long long int a,b,c;
		scanf("%lld %lld %lld",&a,&b,&c);
		friends[i].cost=a;
		friends[i].monitors=b;
		friends[i].probs=c;
		int mask=0;
		for(int j=0;j<c;j++)
		{
			int x;
			scanf("%d",&x);
			x--;
			mask=mask|(1<<x);
		}
		friends[i].mask=mask;
	}
	sort(friends+1,friends+n+1,cmp);
	u long long ans=INF;
	for(int i=1;i<=n;i++)
	{
		int mask=friends[i].mask;
		u long long ff=func(mask,i-1,0);
		if(ff<INF)
			ans=min(ans,func(mask,i-1,0)+friends[i].monitors * k+friends[i].cost);
	}
	if(ans==INF)
		ans=-1;
	printf("%lld\n",ans );
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define INF (1LL<<60)
long long n,m,k;
long long  dp[1<<21];
struct node
{
	  long long cost;
	  long long monitors;
	  long long probs;
	  long long mask;
}friends[105];
bool cmp(node a,node b)
{
	return a.monitors < b.monitors;
}
long long func(long long  mask,int i)
{
	if(i==0)
	{
		if(mask==((1<<m)-1))
			return 0;
		return INF;
	}
	if(dp[mask]!=-1)
		return dp[mask];
	  long long l=func(mask,i-1);
	long long  newmask=friends[i].mask | mask;
	long long ff=func(newmask,i-1);
	  if(ff<INF)
	  		ff+=friends[i].cost;
	  long long r=ff;
	return dp[mask]=min(l,r);
}
int main()
{
	memset(dp,-1,sizeof(dp));
	dp[0]=0;
	scanf("%lld %lld %lld",&n,&m,&k);
	//friends.p sh_back(make_pair(0,make_pair(0,0)));
	for(int i=1;i<=n;i++)
	{
		  long long int a,b,c;
		scanf("%lld %lld %lld",&a,&b,&c);
		friends[i].cost=a;
		friends[i].monitors=b;
		friends[i].probs=c;
		long long mask=0;
		for(int j=0;j<c;j++)
		{
			long long int x;
			scanf("%lld",&x);
			x--;
			mask=mask|(1<<x);
		}
		friends[i].mask=mask;
	}
	sort(friends,friends+n+1,cmp);
	  long long ans=INF;
	for(int i=1;i<=n;i++)
	{
		long long int mask=friends[i].mask;
		  long long ff=func(mask,i-1);
		if(ff<INF)
			ans=min(ans,ff+friends[i].monitors * k+friends[i].cost);
	}
	if(ans>=INF)
		ans=-1;
	printf("%lld\n",ans );
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define INF 9223372036854775807LL
long long n,m,k;
long long  dp[1<<21];
struct node
{
	  long long cost;
	  long long monitors;
	  long long probs;
	  long long mask;
}friends[105];
bool cmp(node a,node b)
{
	return a.monitors < b.monitors;
}
  long long func(long long  mask,int i)
{
	if(mask==((1<<m)-1))
		return 0;
	if(i==0)
		return INF;
	if(dp[mask]!=-1)
		return dp[mask];
	  long long l=func(mask,i-1);
	long long  newmask=friends[i].mask | mask;
	  long long r=func(newmask,i-1)+friends[i].cost;
	return dp[mask]=min(l,r);
}
int main()
{
	memset(dp,-1,sizeof(dp));
	scanf("%lld %lld %lld",&n,&m,&k);
	//friends.p sh_back(make_pair(0,make_pair(0,0)));
	for(int i=1;i<=n;i++)
	{
		  long long int a,b,c;
		scanf("%lld %lld %lld",&a,&b,&c);
		friends[i].cost=a;
		friends[i].monitors=b;
		friends[i].probs=c;
		long long mask=0;
		for(int j=0;j<c;j++)
		{
			long long int x;
			scanf("%lld",&x);
			x--;
			mask=mask|(1<<x);
		}
		friends[i].mask=mask;
	}
	sort(friends,friends+n+1,cmp);
	  long long ans=INF;
	for(int i=1;i<=n;i++)
	{
		long long int mask=friends[i].mask;
		  long long ff=func(mask,i-1);
		if(ff<INF)
			ans=min(ans,ff+friends[i].monitors * k+friends[i].cost);
	}
	if(ans>=INF)
		ans=-1;
	printf("%lld\n",ans );
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define INF 1000000002000000000LL
#define u unsigned
u long long n,m,k;
vector<int>prob[105];
u long long  dp[1<<21];
struct node
{
	u long long cost;
	u long long monitors;
	u long long probs;
	u long long mask;
}friends[105];
bool cmp(node a,node b)
{
	return a.monitors < b.monitors;
}
u long long func(int mask,int i,int prev)
{
	if(mask==((1<<m)-1))
		return 0;
	if(i==0 && mask !=((1<<m)-1))
		return INF;
	if(dp[mask]!=-1)
		return dp[mask];
	u long long l=func(mask,i-1,prev);
	int newmask=friends[i].mask | mask;
	int nextprev=prev;
	u long long r=func(newmask,i-1,nextprev)+friends[i].cost;
	return dp[mask]=min(l,r);
}
int main()
{
	memset(dp,-1,sizeof(dp));
	scanf("%lld %lld %lld",&n,&m,&k);
	//friends.push_back(make_pair(0,make_pair(0,0)));
	for(int i=1;i<=n;i++)
	{
		u long long int a,b,c;
		scanf("%lld %lld %lld",&a,&b,&c);
		friends[i].cost=a;
		friends[i].monitors=b;
		friends[i].probs=c;
		int mask=0;
		for(int j=0;j<c;j++)
		{
			int x;
			scanf("%d",&x);
			x--;
			mask=mask|(1<<x);
		}
		friends[i].mask=mask;
	}
	sort(friends+1,friends+n+1,cmp);
	u long long ans=INF;
	for(int i=1;i<=n;i++)
	{
		int mask=friends[i].mask;
		u long long ff=func(mask,i-1,0);
		if(ff<INF)
			ans=min(ans,func(mask,i-1,0)+friends[i].monitors * k+friends[i].cost);
	}
	if(ans==INF)
		ans=-1;
	printf("%lld\n",ans );
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define INF (1LL<<60)
long long n,m,k;
long long  dp[1<<21];
struct node
{
	  long long cost;
	  long long monitors;
	  long long probs;
	  long long mask;
}friends[105];
bool cmp(node a,node b)
{
	return a.monitors < b.monitors;
}
long long func(long long  mask,int i)
{
	if(i==0)
	{
		if(mask==((1<<m)-1))
			return 0;
		return INF;
	}
	if(dp[mask]!=-1 && dp[mask]!=INF)
		return dp[mask];
	  long long l=func(mask,i-1);
	long long  newmask=friends[i].mask | mask;
	long long ff=func(newmask,i-1);
	  if(ff<INF)
	  		ff+=friends[i].cost;
	  long long r=ff;
	return dp[mask]=min(l,r);
}
int main()
{
	memset(dp,-1,sizeof(dp));
	scanf("%lld %lld %lld",&n,&m,&k);
	for(int i=1;i<=n;i++)
	{
		 long long int a,b,c;
		scanf("%lld %lld %lld",&a,&b,&c);
		friends[i].cost=a;
		friends[i].monitors=b;
		friends[i].probs=c;
		long long mask=0;
		for(int j=0;j<c;j++)
		{
			long long int x;
			scanf("%lld",&x);
			x--;
			mask=mask|(1<<x);
		}
		friends[i].mask=mask;
	}
	sort(friends,friends+n+1,cmp);
	  long long ans=INF;
	  long long state=(1<<m)-1;
	  for(int i=1;i<=state;i++)
	  		dp[i]=INF;
	  	dp[0]=0;
	for(int i=1;i<=n;i++)
	{
		for(int j=0;j<state;j++)
		{
			dp[j|friends[i].mask]=min(dp[j|friends[i].mask],dp[j]+friends[i].cost);
		}
		ans=min(ans,dp[state]+friends[i].monitors*k);
		/*long long int mask=friends[i].mask;
		  long long ff=func(mask,i-1);
		if(ff<INF)
			ans=min(ans,ff+friends[i].monitors * k+friends[i].cost);*/
	}
	if(ans>=INF)
		ans=-1;
	printf("%lld\n",ans );
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define INF 1000000000000000000LL
long long n,m,k;
long long  friends[105][3];
vector<int>prob[105];
long long  dp[1<<21];
long long func(int mask,int i,long long moni)
{
	if(mask==((1<<m)-1))
		return 0;
	if(i==n && mask !=((1<<m)-1))
		return INF;
	if(dp[mask]!=-1)
		return dp[mask];
	long long l=func(mask,i+1,moni);
	int newmask=mask;
	for(int j=0;j<prob[i].size();j++)
	{
		newmask=newmask |  (1<<prob[i][j]);
	}
	long long moncost=0;
	if(moni < friends[i][1])
	{
		moncost=(friends[i][1]-moni)*k;
		moni=friends[i][1];
	}
	long long r=func(newmask,i+1,moni)+friends[i][0]+moncost;
	return dp[mask]=min(l,r);
}
int main()
{
	memset(dp,-1,sizeof(dp));
	scanf("%lld %lld %lld",&n,&m,&k);
	for(int i=0;i<n;i++)
	{
		scanf("%lld %lld %lld",&friends[i][0],&friends[i][1],&friends[i][2]);
		for(int j=0;j<friends[i][2];j++)
		{
			int x;
			scanf("%d",&x);
			x--;
			prob[i].push_back(x);
		}
	}
	long long ans=func(0,0,0);
	if(ans==INF)
		ans=-1;
	printf("%lld\n",ans );
	return 0;
}


/*
* @Author: wulala
* @Date:   2014-04-27 21:01:55
* @Last Modified by:   wulala
* @Last Modified time: 2014-04-28 20:39:25
*/
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <queue>
#include <set>
#include <vector>
#include <string>
#include <stack>
#include <ctime>
using namespace std;
#define inf 1e18
#define mint 0x7fffffff
#define eps 1e-9
typedef long long lint;
typedef unsigned long long hint;
#define mod
#define N 108
#define M 2000000

lint n, m, b, tot, cost[N], bot[N], cover[N], dp[2][M], num[N], ans;

inline bool cmp(lint a, lint b) {
	return bot[a] < bot[b];
}

int main() {
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	scanf("%I64d%I64d%I64d", &n, &m, &b);
	for(int i = 1; i <= n; i++) {
		lint s;
		scanf("%I64d%I64d%I64d", cost + i, bot + i, &s);
		while(s--) {
			lint x; scanf("%I64d", &x);
			x = 1 << (x - 1);
			cover[i] |= x;
		}
	}
	for(int i = 1; i <= n; i++) num[i] = i;
	sort(num + 1, num + n + 1, cmp);
	tot = (1 << m) - 1; ans = inf;
	//init
	for(int i = 1; i <= tot; i++)
		dp[0][i] = inf;
	for(int i = 1; i <= n; i++) {
		int k = i & 1, x = num[i];
		for(int j = 0; j <= tot; j++) dp[k][j] = dp[k ^ 1][j];
		for(int j = 0; j <= tot; j++) {
			dp[k][j | cover[x]] = min(dp[k][j | cover[x]], dp[k ^ 1][j] + cost[x]);
			if (j | cover[x] == tot) ans = min(ans, dp[k][tot] + bot[x] * b);
		}
	}
	//work
	ans == inf ? printf("-1\n") : printf("%I64d\n", ans);
	//end

	fclose(stdin); fclose(stdout);
	return 0;
}


/*
* @Author: wulala
* @Date:   2014-04-27 21:01:55
* @Last Modified by:   wulala
* @Last Modified time: 2014-04-27 22:05:06
*/
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <queue>
#include <set>
#include <vector>
#include <string>
#include <stack>
#include <ctime>
using namespace std;
#define inf 1e9
#define mint 0x7fffffff
#define eps 1e-9
typedef long long lint;
typedef unsigned long long hint;
#define mod
#define N 100
#define M 2000000

lint n, m, b, tot, cost[N], bot[N], cover[N], dp[2][M], num[N], ans;

inline bool cmp(lint a, lint b) {
	return bot[num[a]] < bot[num[b]];
}

int main() {
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	scanf("%I64d%I64d%I64d", &n, &m, &b);
	for(int i = 1; i <= n; i++) {
		lint s;
		scanf("%lld%lld%lld", cost + i, bot + i, &s);
		while(s--) {
			lint x; scanf("%lld", &x);
			x = 1 << (x - 1);
			cover[i] |= x;
		}
	}
	for(int i = 1; i <= n; i++) num[i] = i;
	sort(num + 1, num + n + 1, cmp);
	tot = (1 << m) - 1; ans = inf;
	//init
	for(int i = 1; i <= tot; i++)
		dp[0][i] = inf;
	for(int i = 1; i <= n; i++) {
		int k = i & 1, x = num[i];
		for(int j = 0; j <= tot; j++) dp[k][j] = dp[k ^ 1][j];
		for(int j = 0; j <= tot; j++) {
			dp[k][j | cover[x]] = min(dp[k][j | cover[x]], dp[k ^ 1][j] + cost[x]);
			if (j | cover[x] == tot) ans = min(ans, dp[k][tot] + bot[x] * b);
		}
	}
	//work
	ans == inf ? printf("-1\n") : printf("%I64d\n", ans);
	//end

	fclose(stdin); fclose(stdout);
	return 0;
}


/*
* @Author: wulala
* @Date:   2014-04-27 21:01:55
* @Last Modified by:   wulala
* @Last Modified time: 2014-04-28 20:42:39
*/
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <queue>
#include <set>
#include <vector>
#include <string>
#include <stack>
#include <ctime>
using namespace std;
#define inf (2 * 1e18)
#define mint 0x7fffffff
#define eps 1e-9
typedef long long lint;
typedef unsigned long long hint;
#define mod
#define N 108
#define M 2000000

lint n, m, b, tot, cost[N], bot[N], cover[N], dp[2][M], num[N], ans;

inline bool cmp(lint a, lint b) {
	return bot[a] < bot[b];
}

int main() {
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	scanf("%I64d%I64d%I64d", &n, &m, &b);
	for(int i = 1; i <= n; i++) {
		lint s;
		scanf("%I64d%I64d%I64d", cost + i, bot + i, &s);
		while(s--) {
			lint x; scanf("%I64d", &x);
			x = 1 << (x - 1);
			cover[i] |= x;
		}
	}
	for(int i = 1; i <= n; i++) num[i] = i;
	sort(num + 1, num + n + 1, cmp);
	tot = (1 << m) - 1; ans = inf;
	//init
	for(int i = 1; i <= tot; i++)
		dp[0][i] = inf;
	for(int i = 1; i <= n; i++) {
		int k = i & 1, x = num[i];
		for(int j = 0; j <= tot; j++) dp[k][j] = dp[k ^ 1][j];
		for(int j = 0; j <= tot; j++) {
			dp[k][j | cover[x]] = min(dp[k][j | cover[x]], dp[k ^ 1][j] + cost[x]);
			if (j | cover[x] == tot) ans = min(ans, dp[k][tot] + bot[x] * b);
		}
	}
	//work
	ans == inf ? printf("-1\n") : printf("%I64d\n", ans);
	//end

	fclose(stdin); fclose(stdout);
	return 0;
}


/*
* @Author: wulala
* @Date:   2014-04-27 21:01:55
* @Last Modified by:   wulala
* @Last Modified time: 2014-04-28 20:16:46
*/
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <queue>
#include <set>
#include <vector>
#include <string>
#include <stack>
#include <ctime>
using namespace std;
#define inf 1e18
#define mint 0x7fffffff
#define eps 1e-9
typedef long long lint;
typedef unsigned long long hint;
#define mod
#define N 100
#define M 2000000

lint n, m, b, tot, cost[N], bot[N], cover[N], dp[2][M], num[N], ans;

inline bool cmp(lint a, lint b) {
	return bot[num[a]] < bot[num[b]];
}

int main() {
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	scanf("%I64d%I64d%I64d", &n, &m, &b);
	for(int i = 1; i <= n; i++) {
		lint s;
		scanf("%I64d%I64d%I64d", cost + i, bot + i, &s);
		while(s--) {
			lint x; scanf("%I64d", &x);
			x = 1 << (x - 1);
			cover[i] |= x;
		}
	}
	for(int i = 1; i <= n; i++) num[i] = i;
	sort(num + 1, num + n + 1, cmp);
	tot = (1 << m) - 1; ans = inf;
	//init
	for(int i = 1; i <= tot; i++)
		dp[0][i] = inf;
	for(int i = 1; i <= n; i++) {
		int k = i & 1, x = num[i];
		for(int j = 0; j <= tot; j++) dp[k][j] = dp[k ^ 1][j];
		for(int j = 0; j <= tot; j++) {
			dp[k][j | cover[x]] = min(dp[k][j | cover[x]], dp[k ^ 1][j] + cost[x]);
			if (j | cover[x] == tot) ans = min(ans, dp[k][tot] + bot[x] * b);
		}
	}
	//work
	ans == inf ? printf("-1\n") : printf("%I64d\n", ans);
	//end

	fclose(stdin); fclose(stdout);
	return 0;
}


/*
* @Author: wulala
* @Date:   2014-04-27 21:01:55
* @Last Modified by:   wulala
* @Last Modified time: 2014-04-28 20:14:57
*/
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <queue>
#include <set>
#include <vector>
#include <string>
#include <stack>
#include <ctime>
using namespace std;
#define inf 1e9
#define mint 0x7fffffff
#define eps 1e-9
typedef long long lint;
typedef unsigned long long hint;
#define mod
#define N 100
#define M 2000000

lint n, m, b, tot, cost[N], bot[N], cover[N], dp[2][M], num[N], ans;

inline bool cmp(lint a, lint b) {
	return bot[num[a]] < bot[num[b]];
}

int main() {
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	scanf("%I64d%I64d%I64d", &n, &m, &b);
	for(int i = 1; i <= n; i++) {
		lint s;
		scanf("%I64d%I64d%I64d", cost + i, bot + i, &s);
		while(s--) {
			lint x; scanf("%I64d", &x);
			x = 1 << (x - 1);
			cover[i] |= x;
		}
	}
	for(int i = 1; i <= n; i++) num[i] = i;
	sort(num + 1, num + n + 1, cmp);
	tot = (1 << m) - 1; ans = inf;
	//init
	for(int i = 1; i <= tot; i++)
		dp[0][i] = inf;
	for(int i = 1; i <= n; i++) {
		int k = i & 1, x = num[i];
		for(int j = 0; j <= tot; j++) dp[k][j] = dp[k ^ 1][j];
		for(int j = 0; j <= tot; j++) {
			dp[k][j | cover[x]] = min(dp[k][j | cover[x]], dp[k ^ 1][j] + cost[x]);
			if (j | cover[x] == tot) ans = min(ans, dp[k][tot] + bot[x] * b);
		}
	}
	//work
	ans == inf ? printf("-1\n") : printf("%I64d\n", ans);
	//end

	fclose(stdin); fclose(stdout);
	return 0;
}


/*
* @Author: wulala
* @Date:   2014-04-27 21:01:55
* @Last Modified by:   wulala
* @Last Modified time: 2014-04-27 22:02:34
*/
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <queue>
#include <set>
#include <vector>
#include <string>
#include <stack>
#include <ctime>
using namespace std;
#define inf 1e9
#define mint 0x7fffffff
#define eps 1e-9
typedef long long lint;
typedef unsigned long long hint;
#define mod
#define N 100
#define M 2000000

int n, m, b, tot, cost[N], bot[N], cover[N], dp[2][M], num[N], ans;

inline bool cmp(int a, int b) {
	return bot[num[a]] < bot[num[b]];
}

int main() {
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	scanf("%d%d%d", &n, &m, &b);
	for(int i = 1; i <= n; i++) {
		int s;
		scanf("%d%d%d", cost + i, bot + i, &s);
		while(s--) {
			int x; scanf("%d", &x);
			x = 1 << (x - 1);
			cover[i] |= x;
		}
	}
	for(int i = 1; i <= n; i++) num[i] = i;
	sort(num + 1, num + n + 1, cmp);
	tot = (1 << m) - 1; ans = inf;
	//init
	for(int i = 1; i <= tot; i++)
		dp[0][i] = inf;
	for(int i = 1; i <= n; i++) {
		int k = i & 1, x = num[i];
		for(int j = 0; j <= tot; j++) dp[k][j] = dp[k ^ 1][j];
		for(int j = 0; j <= tot; j++) {
			dp[k][j | cover[x]] = min(dp[k][j | cover[x]], dp[k ^ 1][j] + cost[x]);
			if (j | cover[x] == tot) ans = min(ans, dp[k][tot] + bot[x] * b);
		}
	}
	//work
	ans == inf ? printf("-1\n") : printf("%d\n", ans);
	//end

	fclose(stdin); fclose(stdout);
	return 0;
}