#include #include using namespace std; using Mint = atcoder::modint1000000007; int main() { int H, W; cin >> H >> W; vector fact(H + 1); fact[0] = 1; for (int i = 1; i <= H; i++) fact[i] = i * fact[i - 1]; auto C = [&](int N, int r) { return fact[N] / (fact[r] * fact[N - r]); }; Mint ans = 0; for (int r = 0; r <= H; r++) ans += Mint(-1).pow(r) * C(H, r) * (-Mint(2).pow(r) + 1).pow(W); ans *= Mint(-1).pow(H + W); cout << ans.val() << endl; }