#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
long long memo[100002];
long long modpow(long long x, long long n) {
  long long res = 1;
  long long mul = x;
  while (n) {
    if (n % 2) res = res * mul % MOD;
    mul = mul * mul % MOD;
    n /= 2;
  }
  return res;
}
long long fib(long long i) {
  if (i == 0) return 1;
  if (i == 1) return 1;
  if (memo[i]) return memo[i];
  return memo[i] = (fib(i - 2) + fib(i - 1)) % MOD;
}
int main() {
  long long n, m;
  cin >> n >> m;
  long long ans = (modpow(2, n) + MOD - 2) % MOD;
  ans = (ans + fib(m) * 2) % MOD;
  cout << ans << endl;
}
