#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
int n, m;
long long pow(long long b, long long p) {
  long long r = 1;
  b %= mod;
  while (p) {
    if (p & 1) r = (r * b) % mod;
    p >>= 1;
    b = (b * b) % mod;
  }
  return r;
}
int main() {
  cin >> n >> m;
  long long a = (n == 1 ? 1 : pow(2, n / 2 - 1) * (n & 1 ? 3 : 2)) +
                (m == 1 ? 1 : pow(2, m / 2 - 1) * (m & 1 ? 3 : 2)) - 1;
  cout << (a * 2) % mod << endl;
}
