#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long s = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = 0;
    c = getchar();
  }
  while (c >= '0' && c <= '9')
    s = (s << 1) + (s << 3) + (c ^ 48), c = getchar();
  return f ? s : -s;
}
const long long Mod = 1e9 + 9;
long long n, a[1000010], power_2[1000010], ans;
signed main() {
  n = read() / 2;
  a[1] = 1;
  power_2[0] = 1;
  for (register long long i = 1; i <= n; ++i)
    power_2[i] = 1ll * power_2[i - 1] * 2 % Mod;
  for (register long long i = 2; i <= n; ++i)
    a[i] = 1ll * a[i - 1] * (power_2[i] - 3) % Mod;
  for (register long long i = 2; i <= n; ++i)
    ans = 1ll * (ans + 1ll * 4 * a[i] % Mod) % Mod;
  printf("%lld\n",
         (10 + 8 * ans % Mod + 1ll * 2 * ans % Mod * ans % Mod) % Mod);
  return 0;
}
