406465: GYM102416 C Quick coffee

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

C. Quick coffeetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Let's say we would like to give change of $$$d$$$ dollars after a puchase of coffee. The only coins that we can use have values $$$a$$$, $$$a+1$$$, ..., $$$b$$$. Is it possible to give out the change? We are interested in even harder quesion: for given $$$d$$$ and $$$a$$$ what is the smallest $$$b$$$ such that the change can be given?

Input

The input is two numbers $$$1\leq a\leq d\leq 10^9$$$.

Output

Print smallest $$$b$$$ such that $$$d$$$ is a sum of coins from range $$$a, ..., b$$$.

ExamplesInput
19 60
Output
20
Input
100 914
Output
102

加入题单

算法标签: