#include <bits/stdc++.h>
using namespace std;
int n;
int power[1000001];
int main() {
  scanf("%d", &n);
  power[0] = 1;
  for (int i = 0; i < n; i++) power[i + 1] = power[i] * 2 % 1000000009;
  n /= 2;
  int L = 1;
  for (int i = n; i >= 2; i--)
    L = ((long long)(L + 3) * ((long long)power[i] - 3) + 1) % 1000000009;
  L = ((long long)(L + 1) * (L + 1) % 1000000009 + 1) * 2 % 1000000009;
  if (L < 0) L += 1000000009;
  printf("%d\n", L);
  return 0;
}
