#include <bits/stdc++.h>
long long a[1000010], ans;
int n;
int main() {
  scanf("%d", &n);
  n /= 2;
  a[0] = 1;
  for (int i = 0; i <= n; i++) {
    a[i + 1] = (a[i] * 2 + 3) % 1000000009ll;
  }
  ans = 2;
  for (int i = n; i > 1; i--) {
    ans = ((ans + 2) * a[i - 2] + 2) % 1000000009ll;
  }
  ans = (ans * ans + 1) * 2 % 1000000009ll;
  printf("%lld", ans);
}
