#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 10, mod = 1e9 + 7;
long long n, m, dp[N], dp2[N], dpn[N];
long long power(long long x, long long y) {
  long long res = 1;
  long long p = mod;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  if (m > n) swap(n, m);
  dp[1] = 2;
  dp[2] = 4;
  for (int i = 3; i <= n; i++) {
    dp[i] = power(2, dp[i - 1] - 2) + 2;
    dp[i] %= mod;
  }
  dp2[1] = 4;
  dp2[2] = 6;
  for (int i = 3; i <= n; i++) {
    dp2[i] = power(2, dp2[i - 1] - 4) + 4;
    dp2[i] %= mod;
  }
  dpn[1] = dp[m];
  dpn[2] = dp2[m];
  dpn[2] %= mod;
  for (int i = 3; i <= n; i++) {
    dpn[i] = power(2, dpn[i - 1] - 4) + 4;
    dpn[i] %= mod;
  }
  cout << dp2[n];
}
