#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int N = 1000010;
int n, m;
int f[2][2][N], ans;
template <typename T>
void gi(T &x) {
  x = 0;
  register char c = getchar(), pre = 0;
  for (; c < '0' || c > '9'; pre = c, c = getchar())
    ;
  for (; c >= '0' && c <= '9'; c = getchar()) x = x * 10ll + (c ^ 48);
  if (pre == '-') x = -x;
}
int ksm(int x, int y = mod - 2) {
  int w = 1;
  for (; y; y >>= 1, x = 1ll * x * x % mod)
    if (y & 1) w = 1ll * x * w % mod;
  return w;
}
int main() {
  gi(n), gi(m);
  if (n < m) swap(n, m);
  if (n == 1) {
    puts("2");
    return 0;
  }
  if (n == 2) {
    if (m == 1)
      puts("4");
    else
      puts("4");
    return 0;
  }
  f[1][0][1] = f[0][1][1] = 1;
  for (int i = (2); i <= (n); i++) {
    for (int j = (0); j <= (1); j++)
      for (int k = (0); k <= (1); k++)
        for (int h = (0); h <= (1); h++) {
          if (i == k && k == h) continue;
          f[j][k][i] = (f[j][k][i] + f[h][j][i - 1]) % mod;
        }
  }
  for (int i = (0); i <= (1); i++)
    for (int j = (0); j <= (1); j++) ans = (ans + f[i][j][n]) % mod;
  printf("%d\n", ans);
  return 0;
}
