CYK's very fun graph building game

Count colorings of N vertices with K colors plus edge sets where each vertex points to at most one smaller vertex of a different color, modulo 1000000007.

Medium6Dynamic programmingCombinatoricsMathNo attempts yetTime limit1sMemory limit256 MB

Problem

You build a graph on NN vertices. Number the vertices 11 through NN and paint each one with one of KK colors. Any coloring is allowed.

Once the colors are fixed, you add edges. The edges must follow two rules.

  • If 1j<iN1 \le j < i \le N and vertex ii and vertex jj have different colors, you may add an edge from ii to jj. You may also leave it out.
  • Every vertex ii with 2iN2 \le i \le N has at most one outgoing edge, so the out-degree of vertex ii is never more than 11.

Vertex 11 has no vertex with a smaller number, so it can never have an outgoing edge.

Two graphs are the same when every vertex carries the same color in both and the two edge sets are equal. For example, with N=3N = 3 and K=2K = 2 there are 24 different graphs, shown below.

Given NN and KK, find the number of different graphs modulo 1,000,000,007.

Input

The first line contains the number of vertices NN (1N1001 \le N \le 100) and the number of available colors KK (1K31 \le K \le 3), separated by a single space.

Output

Print the number of different graphs modulo 1,000,000,007 on one line.