#include <bits/stdc++.h>
using namespace std;
long long s[1000005], g[1000005];
int main() {
  int n;
  scanf("%d", &n);
  long long t = 2;
  n = n / 2 - 1;
  g[0] = 4;
  for (int i = 1; i <= n; i++) {
    t = (t << 1) % 1000000009;
    g[i] = g[i - 1] * (t - 3) % 1000000009;
    s[i] = (s[i - 1] + g[i]) % 1000000009;
  }
  int ans = (10 + (s[n] * s[n] * 2) % 1000000009 + (8 * s[n]) % 1000000009 +
             1000000009) %
            1000000009;
  printf("%d\n", ans);
  return 0;
}
