#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
const int modulo = 1e9 + 7;
long long res;
int ksm(int a, int b) {
  int ans = 1, base = a;
  while (b != 0) {
    if (b & 1 != 0) ans *= base;
    base *= base;
    b >>= 1;
  }
  return ans;
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  res = ksm(2, m - 1) + 2;
  res = res + (n - 1) * 2;
  res %= modulo;
  printf("%lld", res);
  return 0;
}
