#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3fll;
const long long mod = (long long)(1e9 + 7);
const int N = 1000010;
const int dir[][2] = {{-1, 0}, {0, -1}, {1, 0}, {0, 1}};
int n, m;
long long ans[N], sum[N];
int main() {
  ans[1] = 2, ans[2] = 4;
  sum[1] = 2, sum[2] = 6;
  for (int i = 3; i < N; ++i) {
    ans[i] = (ans[i - 1] + ans[i - 2]) % mod;
    sum[i] = (sum[i - 1] + ans[i]) % mod;
  }
  while (cin >> n >> m) {
    long long add;
    if (m == 1)
      add = 2;
    else
      add = sum[m - 2] + 2;
    cout << (ans[n] + add) % mod << endl;
  }
  return 0;
}
