#A. B - Quadruple

    Type: Default 1000ms 256MiB

B - Quadruple

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

n的范围 n105n\le 10^5

Score : 400 points

Problem Statement

Given are integers N and K. How many quadruples of integers (a,b,c,d) satisfy both of the following conditions?

  • 1a,b,c,dN
  • a+bcd=K

Constraints

  • 1N105
  • 2(N1)K2(N1)
  • All numbers in input are integers.

Input

Input is given from standard input in the following format:

N K

Output

Print the answer.


Sample Input 1

2 1

Sample Output 1

4

Four quadruples below satisfy the conditions:

  • (a,b,c,d)=(2,1,1,1)
  • (a,b,c,d)=(1,2,1,1)
  • (a,b,c,d)=(2,2,2,1)
  • (a,b,c,d)=(2,2,1,2)

Sample Input 2

2525 -425

Sample Output 2

10314607400

GDOI名额比赛

Not Attended
Status
Done
Rule
IOI
Problem
5
Start at
2025-2-8 14:00
End at
2025-2-8 17:00
Duration
3 hour(s)
Host
Partic.
19