link.
此外,样例不符合 b2≤d<(b+1)2b^2\le d\lt (b+1)^2b2≤d<(b+1)2 的要求,且过水。可以考虑替换成
Input
3 13 5
Output
393
5 29 114514
4997196309027367968