Tree and paths of length two

Decide whether some tree on N nodes has exactly S simple paths of length 2.

Medium4TreeCombinatoricsGreedyNo attempts yetTime limit2sMemory limit512 MB

Problem

Given NN and SS, write a program that decides whether a tree satisfying both of the following conditions exists.

  • The tree has NN nodes.
  • The number of simple paths of length 2 is SS.

A simple path is a path that does not pass through the same vertex more than once. The length of a path is the number of edges on it, so a simple path of length 2 joins three distinct vertices.

Direction does not matter in a path. A-B-C and C-B-A count as the same path.

Input

The first line contains NN and SS separated by a space. (1N501 \le N \le 50, 1S10001 \le S \le 1000)

Output

Print 1 if such a tree can be built, and 0 if it cannot.