#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long n, m, c;
long long cha[1111111], thefirst[1111111], thesecond[1111111], ans[1111111];
int main() {
  scanf("%lld%lld", &n, &m);
  cha[1] = 0;
  cha[2] = 1;
  thefirst[1] = 1;
  thefirst[2] = 2;
  thesecond[1] = 2;
  thesecond[2] = 3;
  for (long long i = 3; i <= 100000; i++)
    cha[i] = (cha[i - 1] + cha[i - 2] + 1) % mod;
  for (long long i = 3; i <= 100000; i++)
    thefirst[i] = (thefirst[i - 1] + thefirst[i - 2]) % mod;
  for (long long i = 3; i <= 100000; i++)
    thesecond[i] = (thesecond[i - 1] + thesecond[i - 2] - 1) % mod;
  ans[1] = thefirst[n] % mod;
  ans[2] = thesecond[n] % mod;
  c = cha[n];
  for (long long i = 3; i <= 100000; i++)
    ans[i] = (ans[i - 1] + ans[i - 2] - c) % mod;
  printf("%lld\n", ans[m] * 2 % mod);
}
