#include <bits/stdc++.h>
using namespace std;
const int p = 1e9 + 7;
long long Pow(long long x, long long d) {
  if (!d) return 1;
  long long tans = Pow(x, d / 2);
  tans = tans * tans % p;
  if (d % 2) tans = tans * x % p;
  return tans % p;
}
int main() {
  int n, m;
  cin >> n >> m;
  cout << Pow(2, min(n, m) + 1);
  return 0;
}
