#include using namespace std; void read(vector &v, int sz) { for(int i = 0; i < sz; i++) { cin >> v[i]; } } long long get_floor(long long lo, long long hi) { long long x = (lo + hi); if(abs(x) % 2 == 0) return x / 2; if(x > 0) return x / 2; return (x - 1) / 2; } long long solve(vector &x, vector &y, long long mid) { int j = (int) y.size() - 1; long long ans = 0LL; for(int i = 0; i < (int) x.size(); i++) { while(j >= 0 && x[i] * 1LL * y[j] > mid) --j; ans += j + 1; } return ans; } long long solve2(vector &x, vector &y, long long mid) { int j = (int) y.size() - 1; long long ans = 0LL; for(int i = (int) x.size() - 1; i >= 0; i--) { while(j >= 0 && x[i] * 1LL * y[j] <= mid) --j; ans += (int) y.size() - 1 - j; } return ans; } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int K, L, M, N; long long S; cin >> K >> L >> M >> N >> S; vector A(K), B(L), C(M), D(N); read(A, K); read(B, L); read(C, M); read(D, N); vector fl, fr; for(int i = 0; i < K; i++) for(int j = 0; j < L; j++) fl.push_back(A[i] * B[j]); sort(fl.begin(), fl.end()); for(int i = 0; i < M; i++) for(int j = 0; j < N; j++) fr.push_back(C[i] * D[j]); sort(fr.begin(), fr.end()); vector> l(2), r(2); int zl = 0, zr = 0; for(int i = 0; i < K; i++) { for(int j = 0; j < L; j++) { if(A[i] * B[j] > 0) l[0].push_back(A[i] * B[j]); else if(A[i] * B[j] == 0) ++zl; else l[1].push_back(A[i] * B[j]); } } for(int i = 0; i < M; i++) { for(int j = 0; j < N; j++) { if(C[i] * D[j] > 0) r[0].push_back(C[i] * D[j]); else if(C[i] * D[j] == 0) ++zr; else r[1].push_back(C[i] * D[j]); } } for(int i = 0; i < 2; i++) sort(l[i].begin(), l[i].end()), sort(r[i].begin(), r[i].end()); reverse(l[1].begin(), l[1].end()); reverse(r[1].begin(), r[1].end()); long long lo = -1e18, hi = 1e18; for(int j = 0; j < 62; j++) { long long mid = get_floor(lo, hi); long long num = 0LL; num += solve(l[0], r[0], mid); num += solve(l[1], r[1], mid); num += solve2(l[0], r[1], mid); num += solve2(r[0], l[1], mid); if(mid >= 0) num += zl * 1LL * zr + zl * 1LL * M * N + zr * 1LL * K * L; if(num < S) lo = mid + 1; else hi = mid; } long long T = lo; long long left = 0LL, right = 0LL; for(int i = 0; i < K * L; i++) if(T % fl[i] == 0) { int it = lower_bound(fr.begin(), fr.end(), T / fl[i]) - fr.begin(); if(fr[it] == T / fl[i]) left = fl[i], right = T / fl[i]; } pair x, y; for(int i = 0; i < K; i++) { for(int j = 0; j < L; j++) { if(A[i] * 1LL * B[j] == left) x = {A[i], B[j]}; } } for(int i = 0; i < M; i++) { for(int j = 0; j < N; j++) { if(C[i] * 1LL * D[j] == right) y = {C[i], D[j]}; } } cout << T << "\n"; cout << x.first << " " << x.second << " " << y.first << " " << y.second << "\n"; }