#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int MAX = 2e6 + 50;
const int mod = 1e9 + 7;
long long n, m;
long long dp[MAX][5];
long long N;
long long ans[MAX][2];
int main() {
  scanf("%lld%lld", &n, &m);
  dp[0][1] = dp[0][2] = dp[0][3] = dp[0][4] = 1;
  dp[2][1] = 1;
  dp[1][2] = 1;
  dp[1][3] = dp[1][4] = 0;
  dp[2][1] = dp[2][2] = 1;
  dp[2][3] = dp[2][4] = 1;
  for (int i = 3; i <= m; i++) {
    dp[i][1] = (dp[i - 1][2] + dp[i - 1][4]) % mod;
    dp[i][2] = (dp[i - 1][1] + dp[i - 1][3]) % mod;
    dp[i][3] = (dp[i - 2][2] + dp[i - 2][4]) % mod;
    dp[i][4] = (dp[i - 2][1] + dp[i - 2][3]) % mod;
  }
  N = (dp[m][1] + dp[m][2] + dp[m][3] + dp[m][4] - 2) % mod;
  ans[1][0] = 2;
  ans[1][1] = 0;
  for (int i = 2; i <= m; i++) {
    ans[i][0] = (ans[i - 1][0] + ans[i - 1][1]) % mod;
    ans[i][1] = (ans[i - 1][0]) % mod;
  }
  printf("%lld\n", (ans[n][0] + ans[n][1] + N) % mod);
  return 0;
}
