#include <bits/stdc++.h>
const int MOD = 10e9 + 7;
int m, n;
int main() {
  std::cin >> n >> m;
  int a = (m / 2) * 2;
  int b = (n / 2) * 2;
  int x = ((a * b) / 2) - 1;
  int kq = 1;
  for (int i = 1; i <= x; i++) {
    kq = (kq * 2) % MOD;
  }
  int c = 0;
  bool bm = (m % 2 == 1), bn = (n % 2 == 1);
  if (bm) c += n;
  if (bn) c += m;
  if ((bm) && (bn)) c--;
  int kqc = 1;
  if (c % 2 == 1) {
    kqc = 2;
  }
  c = c / 2;
  for (int i = 1; i <= c; i++) {
    kqc = (kqc * 2) % MOD;
  }
  kq = (kq * 2) % MOD;
  int outp = (kq * kqc) % MOD;
  std::cout << outp;
  return 0;
}
