Under construction

Still being built. Things may change

One Root

Time limit2sMemory limit512 MB

Summary
Count pairs (p, q) with |p|, |q| <= m for which x^n + px + q has exactly one real root.
Level

Hard9 of 10

Topics
Math, Number theory, Dynamic programming, Implementation
Solved
No attempts yet

Problem

For a fixed nn and integers pp and qq such that ∣p∣≤m|p| \le m and ∣q∣≤m|q| \le m, how many equations of the form

xn+px+q=0x^n + px + q = 0 have exactly one real root?

Input

The only line of input contains two integers nn and mm (1≤n,m≤1061 \le n, m \le 10^6, n≥2n \ge 2).

Output

Print a single integer: the number of equations having exactly one real root.

Examples2

  1. Example 1

    Input
    2 4
    
    Expected output
    5
    
  2. Example 2

    Input
    3 5
    
    Expected output
    96