#include <bits/stdc++.h>
const int maxn = 1e5 + 9;
const int MOD = 1e9 + 7;
using namespace std;
long long quick(long long a, long long n) {
  long long ans = 1, temp = a;
  while (n) {
    if (n & 1) {
      ans *= temp;
      ans %= MOD;
    }
    temp = temp * temp;
    temp %= MOD;
    n = n >> 1;
  }
  return ans;
}
int main() {
  int n, m;
  while (scanf("%d%d", &n, &m) != EOF) {
    long long ans = quick(2, n * m) - 7 * quick(n, m) % MOD;
    printf("%lld\n", (ans + MOD) % MOD);
  }
}
