Valentine has decided to congratulate all of his girlfriends by giving each one a yellow rose. In the nearby flower market yellow roses are sold by exactly two vendors. Each of them has an unlimited amount of roses; however, they sell roses only in bouquets (so you can only buy a certain amount of roses at a time). At the first vendor you can buy a bouquet of roses for Euros; at the second vendor – a bouquet of roses for Euros. , , , and are all positive integers. If Valentine can buy more than roses for a smaller amount of money than buying precisely roses, he will buy more than roses and gift the leftover to any of the two lovely salesgirls.
Write a program that calculates the minimum amount of money in Euros for which Valentine can buy at least roses!
The input file contains exactly one line. The first and only line contains five integers: , , , , and ; every two consecutive numbers are separated by a single whitespace. The value of does not exceed 10^{15}, the values of , , , and do not exceed 10^{5}.
The output file should contain one line with one natural number – the minimum amount of money in Euros for which Valentine can buy at least roses. It is known that for all given test cases the correct answer does not exceed 10^{18}.
Example 1