#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 100;
long long mult(long long a, long long b) { return a * b % 1000000007; }
long long fastpow(long long n, long long k) {
  long long ret = 1;
  while (k) {
    if (k & 1) ret = mult(ret, n);
    n = mult(n, n);
    k /= 2;
  }
  return ret;
}
int main() {
  long long n, m;
  cin >> n >> m;
  long long ans = m - 1 ? fastpow(2, m - 1) : 0;
  ans = (ans + (n - 1 ? fastpow(2, n - 1) : 0) + 2) % 1000000007;
  cout << ans << endl;
  cin >> n;
}
