#include <bits/stdc++.h>
using namespace std;
int n;
long long ans = 0, s = 0, mod = 1000000009;
long long f[1000010], g[1000010];
long long fpow(int i, int j) {
  long long ret = 0;
  if (j == 0) return 1;
  if (j == 1) return i;
  ret = fpow(i, j / 2);
  ret *= ret;
  if (j % 2 == 1) ret *= i;
  ret %= mod;
  return ret;
}
int main() {
  int i, j;
  scanf("%d", &n);
  g[2] = 1;
  for (i = 3; i <= n; i++) {
    if (i >= 5 && i % 2 == 1) {
      if (i < n)
        f[i] = fpow(2, (i + 1) / 2) - 3;
      else
        f[i] = i - 2;
    } else
      f[i] = 1;
    g[i] = g[i - 1] * f[i] % mod;
  }
  ans = 8;
  for (i = 3; i <= n; i++) {
    ans += g[i] * 8;
    s += g[i] * 2;
    ans %= mod;
    s %= mod;
  }
  s++;
  ans += s * s * 2;
  ans %= mod;
  cout << ans << endl;
  return 0;
}
