#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:200000000")
const double EPS = 1E-9;
const int INF = 1000000000;
const long long INF64 = (long long)1E18;
const double PI = 3.1415926535897932384626433832795;
const int MOD = INF + 9;
int z[2][33][33][33][33], u[2][33][33][33][33], us, p[4], up[4], np[4];
int main() {
  int n, h;
  cin >> n >> h;
  z[1][0][0][0][0] = 1;
  us++;
  u[1][0][0][0][0] = us;
  for (int nn = 1; nn <= n; nn++) {
    int cur = nn % 2;
    int nxt = 1 - nn % 2;
    int nus = us + 1;
    for (p[0] = 0; p[0] <= h; p[0]++)
      for (p[1] = p[0]; p[1] <= h; p[1]++)
        for (p[2] = p[1]; p[2] <= h; p[2]++)
          for (p[3] = p[2]; p[3] <= h; p[3]++)
            if (u[cur][p[0]][p[1]][p[2]][p[3]] == us &&
                z[cur][p[0]][p[1]][p[2]][p[3]]) {
              for (int i = 0; i < (int)(4); i++) up[i] = min(h, p[i] + 1);
              for (int i = 0; i < (int)(4); i++) {
                memcpy(np, up, sizeof(up));
                if (p[i] < h) {
                  np[i] = 0;
                  for (int j = i; j > 0 && np[j] < np[j - 1]; j--)
                    swap(np[j], np[j - 1]);
                }
                if (u[nxt][np[0]][np[1]][np[2]][np[3]] != nus) {
                  u[nxt][np[0]][np[1]][np[2]][np[3]] = nus;
                  z[nxt][np[0]][np[1]][np[2]][np[3]] = 0;
                }
                z[nxt][np[0]][np[1]][np[2]][np[3]] +=
                    z[cur][p[0]][p[1]][p[2]][p[3]];
                if (z[nxt][np[0]][np[1]][np[2]][np[3]] >= MOD)
                  z[nxt][np[0]][np[1]][np[2]][np[3]] -= MOD;
              }
            }
    us++;
  }
  int ans = 0;
  int cur = (n + 1) % 2;
  for (p[0] = 0; p[0] < h; p[0]++)
    for (p[1] = p[0]; p[1] <= h; p[1]++)
      for (p[2] = p[1]; p[2] <= h; p[2]++)
        for (p[3] = p[2]; p[3] <= h; p[3]++)
          if (u[cur][p[0]][p[1]][p[2]][p[3]] == us) {
            ans += z[cur][p[0]][p[1]][p[2]][p[3]];
            ans %= MOD;
          }
  cout << ans << endl;
  cerr << clock() << endl;
  return 0;
}
