#include <bits/stdc++.h>
using namespace std;
inline void add(int &a, int b) {
  a += b;
  if (a >= 1000000007) a -= 1000000007;
}
int two[555];
int dp[2][555][555];
int sum[2][555][555];
int sumsum[2][555][555];
int sumsumy[2][555][555];
int n, tot;
int main() {
  clock_t begin = clock();
  two[0] = 1;
  for (int i = 1; i <= 500; ++i) two[i] = two[i - 1] * 2 % 1000000007;
  scanf("%d%d", &n, &tot);
  dp[0][0][0] = 1, sum[0][0][0] = 1;
  for (int i = 1; i <= n; ++i) sum[0][i][0] = sum[0][i - 1][0] + dp[0][i][0];
  for (int i = 0; i <= n; ++i)
    for (int k = 0; k <= i; ++k) {
      int cur = 0;
      if (k == 0)
        sumsum[cur][i][k] = sum[cur][i][k];
      else
        add(sumsum[cur][i][k], sumsum[cur][i][k - 1] + sum[cur][i][k]);
      if (k == 0)
        sumsumy[cur][i][k] = (long long)sum[cur][i][k] * two[k] % 1000000007;
      else
        add(sumsumy[cur][i][k],
            (sumsumy[cur][i][k - 1] + (long long)sum[cur][i][k] * two[k]) %
                1000000007);
    }
  int cur = 1, prv = 0;
  for (int j = 1; j <= tot; ++j) {
    for (int i = 0; i <= n; ++i)
      for (int k = 0; k <= i; ++k) {
        sumsum[cur][i][k] = sumsumy[cur][i][k] = 0;
        dp[cur][i][k] = sum[cur][i][k] = 0;
        if (i != 0) {
          int &ret = dp[cur][i][k];
          add(ret, (long long)sum[cur][i - 1][k] * (two[k] - 1) % 1000000007);
          if (k == i) {
            add(ret, ((long long)sumsum[prv][i - 1][k - 1] * two[k] -
                      sumsumy[prv][i - 1][k - 1] + 1000000007) %
                         1000000007);
          }
        }
        if (i == 0)
          sum[cur][i][k] = dp[cur][i][k];
        else
          add(sum[cur][i][k], sum[cur][i - 1][k] + dp[cur][i][k]);
        if (k == 0)
          sumsum[cur][i][k] = sum[cur][i][k];
        else
          add(sumsum[cur][i][k], sumsum[cur][i][k - 1] + sum[cur][i][k]);
        if (k == 0)
          sumsumy[cur][i][k] = (long long)sum[cur][i][k] * two[k] % 1000000007;
        else
          add(sumsumy[cur][i][k],
              (sumsumy[cur][i][k - 1] + (long long)sum[cur][i][k] * two[k]) %
                  1000000007);
      }
    swap(cur, prv);
  }
  int ans = 0;
  for (int i = 0; i <= n; ++i)
    for (int j = 0; j <= i; ++j) add(ans, dp[prv][i][j]);
  printf("%d\n", (ans + 1000000007) % 1000000007);
  clock_t end = clock();
}

### Prompt

In cpp, your task is to solve the following problem:

Let's assume that set S consists of m distinct intervals [l1, r1], [l2, r2], ..., [lm, rm] (1 ≤ li ≤ ri ≤ n; li, ri are integers).

Let's assume that f(S) is the maximum number of intervals that you can choose from the set S, such that every two of them do not intersect. We assume that two intervals, [l1, r1] and [l2, r2], intersect if there is an integer x, which meets two inequalities: l1 ≤ x ≤ r1 and l2 ≤ x ≤ r2.

Sereja wonders, how many sets S are there, such that f(S) = k? Count this number modulo 1000000007 (109 + 7).

Input

The first line contains integers n, k (1 ≤ n ≤ 500; 0 ≤ k ≤ 500).

Output

In a single line, print the answer to the problem modulo 1000000007 (109 + 7).

Examples

Input

3 1


Output

23


Input

3 2


Output

32


Input

2 0


Output

1


Input

2 2


Output

2

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
inline void add(int &a, int b) {
  a += b;
  if (a >= 1000000007) a -= 1000000007;
}
int two[555];
int dp[2][555][555];
int sum[2][555][555];
int sumsum[2][555][555];
int sumsumy[2][555][555];
int n, tot;
int main() {
  clock_t begin = clock();
  two[0] = 1;
  for (int i = 1; i <= 500; ++i) two[i] = two[i - 1] * 2 % 1000000007;
  scanf("%d%d", &n, &tot);
  dp[0][0][0] = 1, sum[0][0][0] = 1;
  for (int i = 1; i <= n; ++i) sum[0][i][0] = sum[0][i - 1][0] + dp[0][i][0];
  for (int i = 0; i <= n; ++i)
    for (int k = 0; k <= i; ++k) {
      int cur = 0;
      if (k == 0)
        sumsum[cur][i][k] = sum[cur][i][k];
      else
        add(sumsum[cur][i][k], sumsum[cur][i][k - 1] + sum[cur][i][k]);
      if (k == 0)
        sumsumy[cur][i][k] = (long long)sum[cur][i][k] * two[k] % 1000000007;
      else
        add(sumsumy[cur][i][k],
            (sumsumy[cur][i][k - 1] + (long long)sum[cur][i][k] * two[k]) %
                1000000007);
    }
  int cur = 1, prv = 0;
  for (int j = 1; j <= tot; ++j) {
    for (int i = 0; i <= n; ++i)
      for (int k = 0; k <= i; ++k) {
        sumsum[cur][i][k] = sumsumy[cur][i][k] = 0;
        dp[cur][i][k] = sum[cur][i][k] = 0;
        if (i != 0) {
          int &ret = dp[cur][i][k];
          add(ret, (long long)sum[cur][i - 1][k] * (two[k] - 1) % 1000000007);
          if (k == i) {
            add(ret, ((long long)sumsum[prv][i - 1][k - 1] * two[k] -
                      sumsumy[prv][i - 1][k - 1] + 1000000007) %
                         1000000007);
          }
        }
        if (i == 0)
          sum[cur][i][k] = dp[cur][i][k];
        else
          add(sum[cur][i][k], sum[cur][i - 1][k] + dp[cur][i][k]);
        if (k == 0)
          sumsum[cur][i][k] = sum[cur][i][k];
        else
          add(sumsum[cur][i][k], sumsum[cur][i][k - 1] + sum[cur][i][k]);
        if (k == 0)
          sumsumy[cur][i][k] = (long long)sum[cur][i][k] * two[k] % 1000000007;
        else
          add(sumsumy[cur][i][k],
              (sumsumy[cur][i][k - 1] + (long long)sum[cur][i][k] * two[k]) %
                  1000000007);
      }
    swap(cur, prv);
  }
  int ans = 0;
  for (int i = 0; i <= n; ++i)
    for (int j = 0; j <= i; ++j) add(ans, dp[prv][i][j]);
  printf("%d\n", (ans + 1000000007) % 1000000007);
  clock_t end = clock();
}

```