#include <bits/stdc++.h>
using namespace std;
long long mod_add(long long a, long long b) { return (a + b) % 1000000009; }
long long mod_mult(long long a, long long b) { return (a * b) % 1000000009; }
long long fv[100001];
long long f(long long a) {
  if (a < 0) return 0;
  if (a == 0) return 1;
  if (fv[a] == 0) fv[a] = mod_add(f(a - 1), f(a - 2));
  return fv[a];
}
long long fov[100001];
long long f_one(long long a) {
  if (a < 0) return 0;
  if (a == 0) return 1;
  if (a == 1) return 1;
  if (fov[a] == 0) fov[a] = mod_add(f_one(a - 1), f_one(a - 2));
  return fov[a];
}
vector<string> f_debug(int a) {
  if (a < -1) return vector<string>(0);
  if (a == -1) return vector<string>({"(-1)\n"});
  if (a == 0) return vector<string>({""});
  if (a == 1) return vector<string>({"1\n"});
  vector<string> ans(0), fm1(f_debug(a - 1)), fm3(f_debug(a - 3));
  for (int i = 0; i < fm1.size(); i++) {
    ans.push_back("1\n" + fm1[i]);
  }
  for (int i = 0; i < fm3.size(); i++) {
    ans.push_back("2\n" + fm3[i]);
  }
  return ans;
}
int main() {
  int h, w;
  cin >> h >> w;
  if (h == 1) {
    cout << mod_mult(2, f_one(w));
  } else if (w == 1) {
    cout << mod_mult(2, f_one(h));
  } else {
    cout << mod_mult(2, (mod_add(f(h), f(w) - 1)));
  }
}
