#include using namespace std; #define rep(i, n) for(int i = 0; i < n; i++) #define rep2(i, x, n) for(int i = x; i <= n; i++) #define rep3(i, x, n) for(int i = x; i >= n; i--) #define each(e, v) for(auto &e: v) #define pb push_back #define eb emplace_back #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define sz(x) (int)x.size() using ll = long long; using pii = pair; using pil = pair; using pli = pair; using pll = pair; const int MOD = 1000000007; //const int MOD = 998244353; const int inf = (1<<30)-1; const ll INF = (1LL<<60)-1; template bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;}; template bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;}; struct io_setup{ io_setup(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout << fixed << setprecision(15); } } io_setup; int main(){ int A, B, C, D; ll K; cin >> A >> B >> C >> D >> K; vector a(A), b(B), c(C), d(D); rep(i, A) cin >> a[i]; rep(i, B) cin >> b[i]; rep(i, C) cin >> c[i]; rep(i, D) cin >> d[i]; vector P1, P2, P3, Q; map mp1, mp2; rep(i, A){ rep(j, B){ ll x = a[i]*b[j]; if(x > 0) P1.eb(x); if(x == 0) P2.eb(x); if(x < 0) P3.eb(-x); mp1[a[i]*b[j]] = pii(i, j); } } sort(all(P1)), sort(all(P3)); rep(i, C){ rep(j, D){ Q.eb(c[i]*d[j]); mp2[c[i]*d[j]] = pii(i, j); } } sort(all(Q)); int N = sz(Q); ll L = -INF, R = INF; //(L,R] while(R-L > 1){ ll M = (L+R)/2; ll cnt = 0; int ptr; if(M >= 0){ ptr = N; each(e, P1){ while(ptr > 0 && e*Q[ptr-1] > M) ptr--; cnt += ptr; } cnt += 1LL*sz(P2)*N; ptr = 0; each(e, P3){ while(ptr < N && e*Q[ptr] < -M) ptr++; cnt += N-ptr; } } else{ ptr = 0; each(e, P1){ while(ptr < N && e*Q[ptr] <= M) ptr++; cnt += ptr; } ptr = N; each(e, P3){ while(ptr > 0 && e*Q[ptr-1] >= -M) ptr--; cnt += N-ptr; } } (cnt >= K? R : L) = M; } cout << R << '\n'; if(R == 0){ each(e, mp1){ if(e.first != 0) continue; auto [i, j] = e.second; cout << a[i] << ' ' << b[j] << ' ' << c[0] << ' ' << d[0] << '\n'; return 0; } each(e, mp2){ if(e.first != 0) continue; auto [i, j] = e.second; cout << a[0] << ' ' << a[0] << ' ' << c[i] << ' ' << d[j] << '\n'; return 0; } } each(e, mp1){ if(e.first == 0) continue; int flag = 0; if(R < 0) flag ^= 1; if(e.first < 0) flag ^= 1; if(abs(R)%abs(e.first) != 0) continue; ll x = abs(R)/abs(e.first); if(flag) x *= -1; if(mp2.count(x)){ auto [i, j] = e.second; auto [k, l] = mp2[x]; cout << a[i] << ' ' << b[j] << ' ' << c[k] << ' ' << d[l] << '\n'; return 0; } } }