#include <bits/stdc++.h>
using namespace std;
long long g[1000009], f[1000009];
int main() {
  int n;
  scanf("%d", &n);
  long long ans = 0;
  if (n == 2) {
    ans = 10;
  } else {
    long long a = 2, b = 4, c = 2;
    n -= 2;
    while (n) {
      n -= 2;
      a *= 2;
      a %= 1000000009;
      b *= a - 3;
      b %= 1000000009;
      c = (c + b) % 1000000009;
    }
    ans = (c * c * 2 + 2) % 1000000009;
  }
  printf("%lld\n", ans);
  return 0;
}
