#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  long long a;
  if (m == 1) {
    a = 2;
  } else if (m == 2) {
    a = 4;
  } else {
    long long aa = 2, bb = 4, cc;
    for (int i = 0; i < m - 2; i++) {
      cc = (aa + bb) % MOD;
      bb = aa;
      aa = cc;
    }
    a = cc;
  }
  a = (a + 2 * (n - 1)) % MOD;
  cout << a;
  return 0;
}
