import java.util.*;
import java.lang.*;
import java.io.*;
class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
int p1 = Integer.parseInt(st.nextToken());
int p2 = Integer.parseInt(st.nextToken());
int p3 = Integer.parseInt(st.nextToken());
int k = Integer.parseInt(st.nextToken());
PriorityQueue<Long> pq = new PriorityQueue<>();
int a = 1;
int b = 1;
int c= 1;
for (int i=0; i<10; i++) {
a *= p1;
b=1;
for (int j=0; j<10; j++) {
b *= p2;
c=1;
for (int l=0; l<10; l++) {
c *= p3;
pq.add((long)a*b*c);
}
}
}
for (int i=0; i<k-1; i++) {
pq.poll();
}
System.out.println(pq.poll());
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: