#include <bits/stdc++.h>
using namespace std;
const int maxn = (int)1e5 + 13;
const long long INFL = 9223372036854775807;
const int INF = 2147483647;
const long long MOD = (int)1e9 + 7;
const long long b = 257;
long long dp[maxn];
int main() {
  ios_base::sync_with_stdio(0);
  cout.tie(0);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  int nn = min(n, m);
  int mm = max(n, m);
  n = nn;
  m = mm;
  dp[1] = 2;
  dp[2] = 4;
  long long cnt = 0;
  for (int i = 3; i <= m; ++i) {
    dp[i] = (2 * cnt + ((dp[i - 1] - cnt) / 2) * 3) % MOD;
    cnt = (dp[i - 1] - cnt) / 2;
  }
  cout << dp[m] + dp[n] - 2;
  return 0;
}
