#include #include using namespace atcoder; using Mint = modint1000000007; constexpr int MAX = 1000000; using ll = long long; int main(){ int H, W; scanf("%d %d", &H, &W); Mint fact[MAX+1]; fact[0] = Mint::raw(1); for (int i = 1; i <= MAX; i++) fact[i] = fact[i-1]*Mint::raw(i); Mint ifact[MAX+1]; ifact[MAX] = fact[MAX].inv(); for (int i = MAX; (i); i--) ifact[i-1] = ifact[i]*Mint::raw(i); Mint answer = ifact[H]*((Mint::raw(1) - ifact[2].pow(H)).pow(W) - Mint::raw(1)); for (int i = 1; i < H; i++) { if(i&1) answer -= ifact[i]*ifact[H-i]*ifact[2].pow((ll)W*i)*(Mint::raw(1) - ifact[2].pow(H-i)).pow(W); else answer += ifact[i]*ifact[H-i]*ifact[2].pow((ll)W*i)*(Mint::raw(1) - ifact[2].pow(H-i)).pow(W); } printf("%u\n", ((answer*fact[H] + Mint::raw(1))*Mint::raw(2).pow((long long)H*W)).val()); }