n-th term divisible by a, b or c
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
Given three integers and . Find the -th term which is divisible by either of or .
Input
Four integers and .
Output
Print the -th term divisible by either or or . It is known that the answer is no more than .
Examples
Input #1
Answer #1
Input #2
Answer #2
Input #7
Answer #7
Submissions 1K
Acceptance rate 39%