Under construction

Still being built. Things may change

Swapped Distributive Law

Time limit1sMemory limit1024 MB

Summary
Count integer triples (a, b, c) with absolute values at most N that satisfy a + bc = (a + b)(a + c).
Level

Easy3 of 10

Topics
Math, Implementation
Solved
No attempts yet

Problem

Recently, Jeuti studied addition and multiplication and learned the distributive law. The distributive law means that for any three real numbers aa, bb, cc, the equation a×(b+c)=(a×b)+(a×c)a \times (b + c) = (a \times b) + (a \times c) always holds. Jeuti then wondered whether the expression with the positions of the addition and multiplication signs swapped also holds: for any three real numbers aa, bb, cc, a+(b×c)=(a+b)×(a+c)a + (b \times c) = (a + b) \times (a + c). Jeuti is still young and cannot handle large numbers, so Jeuti can only evaluate these expressions when aa, bb, cc are integers whose absolute values do not exceed NN. Count the integer pairs (a,b,c)(a, b, c) within this range that satisfy the swapped distributive law.

Input

The first line contains NN, the bound on the absolute values of aa, bb, and cc. (1≤N≤3000)(1 \leq N \leq 3000)

Output

Print the number of integer triples (a,b,c)(a, b, c) that satisfy the swapped distributive law.

Examples1

  1. Example 1

    Input
    1
    
    Expected output
    13