프로그램 명: ncpc_event
제한시간: 1 초

[문제요약] 입력 예시


3 1000 2 3 //미팅의 참가자수 , 예산 , 호텔의수 , 가능한 주(1~weekend)

200 // 첫번째 호텔의 인당 숙박비
0 2 2 //첫번째 호텔의  각 주말마다 숙박가능한 인원 

300 // 두번째 호텔의 ...
27 3 20
가능한 최소 경비를 출력한다. 가능하지 않으면 'stay home' 을 출력 (단, 모두 같은 호텔 , 같은 날 숙박해야 한다.)
As you didn't show up to the yearly general meeting of the Nordic Club of Pin Collectors, you were unanimously elected to organize this years excursion to Pin City. You are free to choose from a number of weekends this autumn, and have to find a suitable hotel to stay at, preferably as cheap as possible.

You have some constraints: The total cost of the trip must be within budget, of course. All participants must stay at the same hotel, to avoid last years catastrophe, where some members got lost in the city, never being seen again.

입력

출력

Output the minimum cost of the stay for your group, or "stay home" if nothing can be found within the budget.

입출력 예

입력

3 1000 2 3
200
0 2 2
300
27 3 20

출력

900

입력

5 2000 2 4
300
4 3 0 4
450
7 8 0 13

출력

stay home
출처:ncpc/2008/Problem E

[질/답] [제출 현황] [푼 후(4)]
[ 채 점 ] [홈으로]  [뒤 로]