M. Manic Ceramic
time limit per test
1 second
memory limit per test
1024 megabytes
input
standard input
output
standard output
The bathrooms at the Leiden University library; one of BAPC's biggest clients.

I do not know who is supplying these mathematicians with all this paint, but this has to stop. They have been defacing the tiling in practically every bathroom they visit with different colours and patterns, all apparently for "research purposes". All fun and games, until your friend decided your bathroom was the perfect place to get started on his own mathematical career. Now you're left having to look for new tiles, right in the middle of a global shortage due to the mathematical epidemic.

Luckily, there are still some tiles available at the Bespoke Arbitrary Products Company (BAPC), known for having everything you need, and everything you do not need! At the BAPC, they normally have three different types of patterned bathroom tiles: besides the standard tile with a single pattern on it, they also have multi- and partial-pattern tiles! Any multi-pattern tile contains not one, but $$$x$$$ copies of the pattern. The partial-pattern tiles contain only part of the pattern, so that exactly $$$y$$$ partial-pattern tiles are required to make up a single instance of the pattern. You would have preferred to keep it simple, and tile your entire bathroom with the standard tiles. However, the customer before you has just bought the last standard-pattern tiles! Thus, you are left with the two other types of tiles. Wanting to keep the same balance of patterns to tiles as you would have gotten with the standard tiles, you wonder what the minimum number of multi- and partial-pattern tiles is such that the total number of patterns across all tiles is exactly equal to the number of tiles.

You should buy at least one tile.

As an example, consider the first sample case, where the minimum case is achieved by four partial-pattern tiles and one multi-pattern tile, that together make up precisely $$$4 \cdot \frac{1}{4} + 4 = 5$$$ instances of the pattern.

Input

The input consists of:

  • One line with two integers $$$x$$$ and $$$y$$$ ($$$2\leq x, y \leq {10^8}$$$), the number of patterns on a multi-pattern tile and the number of partial-pattern tiles required to make a single instance of the pattern.
Output

Output the minimum number of tiles you should buy so that you have exactly as many patterns as you have tiles.

Examples
Input
4 4
Output
5
Input
2 9
Output
17