#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
long long dp[5], dp2[4];
int main(int argc, char** argv) {
  int n, m;
  scanf("%d%d", &n, &m);
  dp2[0] = 1;
  dp2[2] = 1;
  for (int i = 1; i < m; i++) {
    long long t0 = dp2[0], t1 = dp2[1], t2 = dp2[2], t3 = dp2[3];
    dp2[0] = (t2 + t3) % mod;
    dp2[1] = (t0) % mod;
    dp2[2] = (t0 + t1) % mod;
    dp2[3] = (t2) % mod;
  }
  long long al = (dp2[1] + dp2[0] + dp2[2] + dp2[3]) % mod;
  dp[0] = 1;
  dp[1] = 0;
  dp[2] = 1;
  dp[3] = 0;
  dp[4] = al - 2;
  for (int i = 1; i < n; i++) {
    long long t0 = dp[0], t1 = dp[1], t2 = dp[2], t3 = dp[3];
    dp[0] = (t2 + t3) % mod;
    dp[1] = (t0) % mod;
    dp[2] = (t0 + t1) % mod;
    dp[3] = (t2) % mod;
  }
  cout << (dp[0] + dp[1] + dp[2] + dp[3] + dp[4]) % mod << endl;
  return 0;
}
