#include <bits/stdc++.h>
using namespace std;
const long long int maxn = 2e5 + 1;
long long int dp[maxn];
void solve() {
  long long int N, M;
  cin >> N >> M;
  dp[1] = 2;
  dp[2] = 4;
  long long int m = max(N, M);
  for (long long int i = 3; i <= m; i++) {
    dp[i] = (dp[i - 2] * 2) % 1000000007;
  }
  if (M == 1) {
    cout << dp[N] << "\n";
    return;
  } else if (N == 1) {
    cout << dp[M] << "\n";
    return;
  }
  long long int ans = (dp[N - 1] * dp[M]) % 1000000007;
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int T = 1, p = 0;
  do {
    solve();
    p++;
  } while (p < T);
  return 0;
}
