Want to solve a problem?

For given K and C, choose A > 0 to maximize the characters saved by writing K+A repeated K+A times instead of K repeated K times, minus C times A.

Hard9String matchingMathNumber theoryGreedyNo attempts yetTime limit1sMemory limit128 MB

Problem

  • Inseop: What problem?
  • Hyunwoo: How many characters do you need to write 11 eleven times?
  • Inseop: 11 has two digits, so 2×11=222 \times 11 = 22!
  • Hyunwoo: Wrong. Twelve characters are enough. Write 111111111111 and 11 shows up eleven times as a contiguous substring.
  • Inseop: Sorry, I will study...
  • Hyunwoo: Then write me the shortest string in which KK appears KK times, by tomorrow.

Inseop is about to start the homework Hyunwoo gave him. Writing KK down KK times turned out to be far too much work. While he was thinking it over, Inseop had a good idea. He writes a string in which K+AK + A (A>0A > 0) appears K+AK + A times, then convinces Hyunwoo that he solved something harder than the original homework because a larger number appears more often. If this cuts the number of characters he has to write by LL, Inseop gains LL satisfaction.

Inseop still feels guilty about not solving the homework exactly. If he writes K+AK + A down K+AK + A times instead of writing KK down KK times, the guilt is proportional to AA. Precisely, for a constant CC he feels C×AC \times A guilt.

Inseop wants to maximize his satisfaction minus his guilt. Find that value.

Numbers may overlap inside the string Inseop writes. For example, 12312 appears twice in the string 12312312, and 3333 appears three times in 333333.

Input

One line contains the two integers KK and CC from the statement, separated by a space. (1K10121 \le K \le 10^{12}, 0C1050 \le C \le 10^5)

Output

Print the answer on one line. If the value is 0 or less for every positive integer AA, print 0.

Hint

Take K=10K = 10 and C=2C = 2. Writing 10 ten times takes 20 characters in total. Writing 11 eleven times takes only 12 characters, so the satisfaction is 8 and the guilt is (1110)×2(11 - 10) \times 2. The answer is 82=68 - 2 = 6.