D2. Magic Powder - 2
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
The term of this problem is the same as the previous one, the only exception — increased restrictions.
Input
The first line contains two positive integers n