Nezuko suddenly woke up on the number line at point $$$0$$$ and has $$$h$$$ health points. She wants to reach point $$$d$$$. In one turn, she can do exactly one of two things:
- rest in the shade and increase her current health by $$$1$$$;
- move from her current position $$$x$$$ to $$$x + 1$$$.
Each movement decreases Nezuko's health; if the movement is the $$$j$$$-th consecutive movement, her health will decrease by $$$j$$$ points. If as a result of a move Nezuko's health drops to $$$0$$$ or below, she cannot make that move.
For example, if Nezuko initially had $$$7$$$ health points and $$$d=4$$$, her moves could look like this:
- Move from $$$0$$$ to $$$1$$$ and decrease health by $$$1$$$. Now she is at point $$$1$$$ with $$$6$$$ health points.
- Move from $$$1$$$ to $$$2$$$ and decrease health by $$$2$$$. Now she is at point $$$2$$$ with $$$4$$$ health points.
- Move from $$$2$$$ to $$$3$$$ and decrease health by $$$3$$$. Now she is at point $$$3$$$ with $$$1$$$ health point.
- Rest and restore $$$1$$$ health point. Now she is at point $$$3$$$ with $$$2$$$ health points.
- Move from $$$3$$$ to $$$4$$$ and decrease health by $$$1$$$. Now she is at point $$$4$$$ with $$$1$$$ health point.
Find the minimum number of turns required for her to reach point $$$d$$$.
Output
For each test case, output one number — the minimum number of turns required for Nezuko to reach point $$$d$$$.
Note
In the first test case, $$$h = 3$$$, $$$d = 2$$$ the actions could be as follows:
- Move from $$$0$$$ to $$$1$$$ and decrease health by $$$1$$$. Now she is at point $$$1$$$ with $$$2$$$ health points.
- Rest and restore $$$1$$$ health point. Now she is at point $$$1$$$ with $$$3$$$ health points.
- Move from $$$1$$$ to $$$2$$$ and decrease health by $$$1$$$. Now she is at point $$$2$$$ with $$$2$$$ health points.
In total, $$$3$$$ turns.
In the fourth test case, $$$h = 2$$$, $$$d = 4$$$ the actions could be as follows:
- Move from $$$0$$$ to $$$1$$$ and decrease health by $$$1$$$. Now she is at point $$$1$$$ with $$$1$$$ health point.
- Rest and restore $$$1$$$ health point. Now she is at point $$$1$$$ with $$$2$$$ health points.
- Move from $$$1$$$ to $$$2$$$ and decrease health by $$$1$$$. Now she is at point $$$2$$$ with $$$1$$$ health point.
- Rest and restore $$$1$$$ health point. Now she is at point $$$2$$$ with $$$2$$$ health points.
- Move from $$$2$$$ to $$$3$$$ and decrease health by $$$1$$$. Now she is at point $$$3$$$ with $$$1$$$ health point.
- Rest and restore $$$1$$$ health point. Now she is at point $$$3$$$ with $$$2$$$ health points.
- Move from $$$3$$$ to $$$4$$$ and decrease health by $$$1$$$. Now she is at point $$$4$$$ with $$$1$$$ health point.
In total, $$$7$$$ turns.