#include using namespace std; const long long INF = 1000000000000000000; int main(){ int K, L, M, N; long long S; cin >> K >> L >> M >> N >> S; vector A(K); for (int i = 0; i < K; i++){ cin >> A[i]; } vector B(L); for (int i = 0; i < L; i++){ cin >> B[i]; } vector C(M); for (int i = 0; i < M; i++){ cin >> C[i]; } vector D(N); for (int i = 0; i < N; i++){ cin >> D[i]; } vector X(K * L); for (int i = 0; i < K; i++){ for (int j = 0; j < L; j++){ X[i * L + j] = A[i] * B[j]; } } vector Y(M * N); for (int i = 0; i < M; i++){ for (int j = 0; j < N; j++){ Y[i * N + j] = C[i] * D[j]; } } sort(Y.begin(), Y.end()); vector pos, neg; long long zero = 0; for (int i = 0; i < K * L; i++){ if (X[i] > 0){ pos.push_back(X[i]); } if (X[i] < 0){ neg.push_back(X[i]); } if (X[i] == 0){ zero++; } } sort(pos.begin(), pos.end(), greater()); sort(neg.begin(), neg.end()); int pcnt = pos.size(); int ncnt = neg.size(); long long tv = -INF; long long fv = INF; while (fv - tv > 1){ long long mid = (tv + fv) / 2; long long cnt = 0; if (mid > 0){ cnt += zero * (N * M); } int pc = 0; for (int i = 0; i < pcnt; i++){ if (pc > 0){ assert(pos[i] * Y[pc - 1] < mid); } while (pc < N * M){ if (pos[i] * Y[pc] < mid){ pc++; } else { break; } } cnt += pc; } int nc = 0; for (int i = 0; i < ncnt; i++){ if (nc > 0){ assert(neg[i] * Y[nc - 1] >= mid); } while (nc < N * M){ if (neg[i] * Y[nc] >= mid){ nc++; } else { break; } } cnt += N * M - nc; } if (cnt < S){ tv = mid; } else { fv = mid; } } cout << tv << endl; for (int i = 0; i < K * L; i++){ int id = -1; if (X[i] >= 0){ int tv2 = -1; int fv2 = N * M; while (fv2 - tv2 > 1){ int mid2 = (tv2 + fv2) / 2; if (X[i] * Y[mid2] <= tv){ tv2 = mid2; } else { fv2 = mid2; } } if (tv2 != -1){ if (X[i] * Y[tv2] == tv){ id = tv2; } } } else { int tv2 = N * M; int fv2 = -1; while (tv2 - fv2 > 1){ int mid2 = (tv2 + fv2) / 2; if (X[i] * Y[mid2] <= tv){ tv2 = mid2; } else { fv2 = mid2; } } if (tv2 != N * M){ if (X[i] * Y[tv2] == tv){ id = tv2; } } } if (id != -1){ bool ok1 = false; for (int j = 0; j < K; j++){ for (int k = 0; k < L; k++){ if (A[j] * B[k] == X[i]){ cout << A[j] << ' ' << B[k] << ' '; ok1 = true; break; } } if (ok1){ break; } } bool ok2 = false; for (int j = 0; j < M; j++){ for (int k = 0; k < N; k++){ if (C[j] * D[k] == Y[id]){ cout << C[j] << ' ' << D[k] << endl; ok2 = true; break; } } if (ok2){ break; } } break; } } }