#include <bits/stdc++.h>
using namespace std;
inline void Boost() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
const int MOD = 1e9 + 7;
int lgpow(int x, int pwr) {
  int ret = 1;
  while (pwr) {
    if (pwr & 1) {
      ret = (1LL * ret * x) % MOD;
    }
    x = (1LL * x * x) % MOD;
    pwr /= 2;
  }
  return ret;
}
int main() {
  Boost();
  int n, m;
  cin >> n >> m;
  if (n == 1 || m == 1) {
    cout << 2;
    return 0;
  }
  int A = lgpow(2, n / 2);
  if (n % 2) A = (2LL * A) % MOD;
  int B = lgpow(2, m / 2);
  if (m % 2) B = (2LL * B) % MOD;
  int ans = (2 + A + B) % MOD;
  cout << ans;
  return 0;
}
