{ll n;rd(n);wt((Mint(3)**n-n%2*6+3)/4);}