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