#include <bits/stdc++.h>
using namespace std;
long long int n, m, mod = 1000000007, ans;
int main() {
  scanf("%lld%lld", &n, &m);
  ans = 1;
  long long int s1, s2;
  if (n == 1 && m == 1) {
    printf("2\n");
    return 0;
  }
  if ((n == 2 && m == 1) || (m == 2 && n == 1)) {
    printf("4\n");
    return 0;
  }
  if (n % 2 == 0) {
    s1 = n / 2;
  } else {
    s1 = n / 2 + 1;
  }
  if (m % 2 == 0) {
    s2 = m / 2;
  } else {
    s2 = m / 2 + 1;
  }
  long long int t = s1 + s2 - 1;
  while (t--) {
    ans *= 2;
    ans %= mod;
  }
  if (n == 1 || m == 1)
    printf("%lld\n", (ans + 2) % mod);
  else {
    printf("%lld\n", (ans + 4) % mod);
  }
  return 0;
}
