#include <bits/stdc++.h>
using namespace std;
const long long maxn = 100010;
const long long mod = 1000000007;
const long double eps = 1e-9;
const long long inf = ((1ll << 31ll) - 1ll);
const long long INF = (((1ll << 62ll) - 1ll) * 2ll) + 1ll;
const long double pi = acos(-1);
long long qpow(long long b, long long e) {
  if (!e) return 1;
  long long pwur = qpow(b, e >> 1);
  return (pwur * pwur) % mod * (b * (e & 1)) % mod;
}
long long n, m, dp[maxn][2];
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.setf(ios::fixed);
  cout.precision(0);
  srand(time(NULL));
  cin >> n >> m;
  dp[0][0] = 1;
  dp[0][1] = 1;
  for (long long i = 1; i <= m; i++) {
    dp[i][0] = (dp[i][0] + dp[i - 1][1]) % mod;
    if (i > 1) dp[i][0] = (dp[i][0] + dp[i - 2][1]) % mod;
    dp[i][1] = (dp[i][1] + dp[i - 1][0]) % mod;
    if (i > 1) dp[i][1] = (dp[i][1] + dp[i - 2][0]) % mod;
  }
  cout << (dp[m][0] + dp[m][1] + (2 * (n > 1))) % mod << '\n';
  return 0;
}
