e-olymp
Problems

n-th term divisible by a, b or c

n-th term divisible by a, b or c

Given three integers a, b and c. Find the n-th term which is divisible by either of a, b or c.

Input

Four integers a, b, c and n (a, b, c, n109).

Output

Print the n-th term divisible by either a or b or c. It is known that the answer is no more than 109.

Time limit 1 second
Memory limit 128 MiB
Input example #1
2 3 5 10
Output example #1
14
Input example #2
3 5 7 10
Output example #2
18