#include <bits/stdc++.h>
using namespace std;
long long int expo(long long int base, long long int exponent) {
  long long int ans = 1;
  while (exponent != 0) {
    if (exponent & 1) ans = (ans * base) % 1000000007;
    base = (base * base) % 1000000007;
    exponent >>= 1;
  }
  return ans % 1000000007;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int n;
  cin >> n;
  long long int m;
  cin >> m;
  if (n == 1 and m == 1) {
    cout << 2 << endl;
    return 0;
  }
  if (n == 1) {
    cout << (expo(2, (m + 1) / 2) + 2) % 1000000007 << endl;
    return 0;
  }
  if (m == 1) {
    cout << (expo(2, (n + 1) / 2) + 2) % 1000000007 << endl;
    return 0;
  }
  cout << (expo(2, max((n + 1) / 2, (m + 1) / 2)) + 4) % 1000000007;
  cerr << "Time elapsed : " << clock() * 1000.0 / CLOCKS_PER_SEC << "ms"
       << '\n';
  return 0;
}
