409228: GYM103463 H Hsueh- and keyboard
Description
Hsueh- has a keyboard.
There is a string which has $$$x$$$ characters in the textarea.
At present, Hsueh- wants to see a string of length exactly $$$n$$$ in the textarea.
You can use the following operations to meet Hsueh-'s requirements.
- Strike the keyboard once, enter a character.
- Strike the keyboard twice(Ctrl + A), select all characters in the textarea.
- Strike the keyboard twice(Ctrl + C), copy the selected character to the clipboard.
- Strike the keyboard twice(Ctrl + V), paste the characters which in the clipboard(Do not empty the clipboard).
- Strike the keyboard once(Backspace), delete character at the end of the textarea or delete the selected character if some characters are selected.
Hsueh- wants to know the minimum number of strokes required to see a string of length exactly $$$n$$$ in the textarea.
What is different from your traditional perception is, if you press Ctrl + A to select all characters and then enter a character or paste some characters, the selected characters will not be deleted. In other words, if you select all characters in the textarea and then enter a character or paste some characters, it will not replace the selected characters but append the characters you enter or paste at the end.
InputThe first line contains two integers $$$x, n(0 \leq x \leq 10^6, 1 \leq n \leq 10^6)$$$, denoting the length of the string which originally appeared in the textarea and the length of the string which Hsueh- wants to see.
OutputPrint a single integer in one line: the minimum number of strokes required to see a string of length exactly $$$n$$$ in the textarea.
ExamplesInput1 4Output
3Input
100 199Output
7