Now Xiao Ming give you four number n,A,B,C.We say a number is beautiful when A or B or C can divide it.As we all know,Xiao Ming is stupid.
Now he want to know what the n-th beautful number is.Can you help him?
(看不懂的刮一下下面的空白地方)
现在小明给你四个数字n、A、B、C。我们说一个数字是美丽的,当它可以被A或B或C整除。众所周知,小明很笨。现在他想知道第n个美丽的数字,你能帮助他吗?
There are multiple groups of input.
For every input the first line give you four number n、A、B、C.
The input make sure the answer is in the [2 , 1e18).
1<=n<=1e9
1<=A、B、C<=1e9
Output only one line.Print the n-th beautful number.
11 2 3 5 1 2 3 5 1 2 2 4
15 2 2 hint: 2、3、4、5、6、8、9、10、12、14、15... The 11-th beautful number is 15. The 1-st beautful number is 2.