#include <bits/stdc++.h>
using namespace std;
long long Fib[100005];
long long solve(long long x) {
  long long temp = 2;
  long long res = 1;
  while (x) {
    if (x & 1) res = ((res % 1000000007) * (temp % 1000000007)) % 1000000007;
    temp = temp % 1000000007 * temp % 1000000007;
    x = x >> 1;
  }
  return res;
}
int main() {
  long long n, m, q, ans;
  scanf("%lld%lld", &n, &m);
  q = (n * m + 1) / 2;
  if (m == 1 || n == 1) {
    Fib[1] = 2;
    Fib[2] = 4;
    long long t = m * n;
    for (int i = 3; i <= t; i++) {
      Fib[i] = Fib[i - 1] + Fib[i - 2];
    }
    printf("%lld\n", Fib[t]);
    return 0;
  }
  ans = solve(q) % 1000000007;
  printf("%lld\n", ans);
  return 0;
}
