#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const double eps = 1e-6;
const long long MOD = 1000000009;
const int maxn = 1 << 20;
long long two[maxn];
int main() {
  int n;
  cin >> n;
  two[0] = 1;
  for (int i = 1; i < maxn; i++) two[i] = (two[i - 1] << 1) % MOD;
  long long x = 2;
  for (int i = (n - 2) / 2; i >= 2; i--) {
    x = (x + 2) % MOD;
    x = (2 + 3 * x + 2 * x * (two[i] - 3));
  }
  if (n >= 4) {
    x = (x + 4) % MOD;
  }
  long long res = (2 * (1 + x * x)) % MOD;
  cout << res << endl;
  return 0;
}
