分析
可得公式:6*(2^n+2^m-4)
具体来看是在棋盘上放置的组合数
#include <iostream> #include <cstdio> using namespace std; typedef long long ll; const ll P=1e9+7; ll n,m; ll Pow(ll x,ll y) {ll ans=1;for (;y;y>>=1,(x*=x)%=P) (ans*=((y&1)?x:1))%=P;return ans;} int main() { scanf("%lld%lld",&n,&m); printf("%lld",(12*(Pow(2,n-1)+Pow(2,m-1))%P-24+P)%P); }