import sys

INF = 99999999

for line in sys.stdin:
    n,b,h,w = map(int,line.split())
    minTotalCost = INF
    for i_h in range(h):
        line = sys.stdin.readline().rstrip('\n')
        person = int(line)
        line = sys.stdin.readline().rstrip('\n')
        ws = list(map(int,line.split()))
        
        #Enough place in hotel
        moreThanN = False
        for e in ws:
            if(e >= n):
                moreThanN = True
                break
        
        #If it is the case
        if(moreThanN):
            totalCost = n * person
            if(totalCost <= b and totalCost < minTotalCost):
                minTotalCost = totalCost
        
    #Answer
    print(minTotalCost if minTotalCost != INF else 'stay home')
        
        
    

a6335e3821dbaf4603387a16309334672d78b86f
<mask token>

<mask token>
for line in sys.stdin:
    n, b, h, w = map(int, line.split())
    minTotalCost = INF
    for i_h in range(h):
        line = sys.stdin.readline().rstrip('\n')
        person = int(line)
        line = sys.stdin.readline().rstrip('\n')
        ws = list(map(int, line.split()))
        moreThanN = False
        for e in ws:
            if e >= n:
                moreThanN = True
                break
        if moreThanN:
            totalCost = n * person
            if totalCost <= b and totalCost < minTotalCost:
                minTotalCost = totalCost
    print(minTotalCost if minTotalCost != INF else 'stay home')

<mask token>
INF = 99999999
for line in sys.stdin:
    n, b, h, w = map(int, line.split())
    minTotalCost = INF
    for i_h in range(h):
        line = sys.stdin.readline().rstrip('\n')
        person = int(line)
        line = sys.stdin.readline().rstrip('\n')
        ws = list(map(int, line.split()))
        moreThanN = False
        for e in ws:
            if e >= n:
                moreThanN = True
                break
        if moreThanN:
            totalCost = n * person
            if totalCost <= b and totalCost < minTotalCost:
                minTotalCost = totalCost
    print(minTotalCost if minTotalCost != INF else 'stay home')

import sys
INF = 99999999
for line in sys.stdin:
    n, b, h, w = map(int, line.split())
    minTotalCost = INF
    for i_h in range(h):
        line = sys.stdin.readline().rstrip('\n')
        person = int(line)
        line = sys.stdin.readline().rstrip('\n')
        ws = list(map(int, line.split()))
        moreThanN = False
        for e in ws:
            if e >= n:
                moreThanN = True
                break
        if moreThanN:
            totalCost = n * person
            if totalCost <= b and totalCost < minTotalCost:
                minTotalCost = totalCost
    print(minTotalCost if minTotalCost != INF else 'stay home')

import sys

INF = 99999999

for line in sys.stdin:
    n,b,h,w = map(int,line.split())
    minTotalCost = INF
    for i_h in range(h):
        line = sys.stdin.readline().rstrip('\n')
        person = int(line)
        line = sys.stdin.readline().rstrip('\n')
        ws = list(map(int,line.split()))
        
        #Enough place in hotel
        moreThanN = False
        for e in ws:
            if(e >= n):
                moreThanN = True
                break
        
        #If it is the case
        if(moreThanN):
            totalCost = n * person
            if(totalCost <= b and totalCost < minTotalCost):
                minTotalCost = totalCost
        
    #Answer
    print(minTotalCost if minTotalCost != INF else 'stay home')
        
        
    
