/*
Problem link
Easy Adhoc
*/
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
using namespace std;
int n,b,h,w;
int main() {
while (!cin.eof())
{
int m = 2000000000;
cin >> n >> b >> h >> w;
if (cin.eof()) break;
for (int i=1; i<=h; i++)
{
int p,k;
cin >> p;
for (int j=1; j<=w; j++)
{
cin >> k;
if (k>=n && n*p<m) m = n*p;
}
}
if (m<=b) cout << m << endl;
else cout << "stay home" << endl;
}
return 0;
}
I love this blog!! The flash up the top is awesome!! event technical production company
ReplyDelete