// Language: Java 17 // Encoding: UTF-8 import java.util.Scanner; /** * Good Luck, Have Fun. */ public class Main { static Scanner scanner = new Scanner(System.in); static int readInt() {return scanner.nextInt();} static int[] readInts(int len) {int[] a=new int[len];for(int i=0;i>1; int d_fix=(turn+1)>>1; int r_left=w-1-r_fix; int d_left=h-1-d_fix; int r_dest=(turn>>1)+1; int d_dest=(turn+1)>>1; if (r_left<0 || d_left<0) break; long pattern=(long)factory[r_left+r_dest-1] *factory_inv[r_left]%mod *factory_inv[r_dest-1]%mod; pattern=pattern*factory[d_left+d_dest-1]%mod *factory_inv[d_left]%mod *factory_inv[d_dest-1]%mod; int fixed = h+w-1+turn-1; long flex = (long)h*w-fixed; long _2xp = Mod.modPow2(flex, mod); sum=(sum+pattern*_2xp%mod)%mod; } System.out.println(sum); } } /** * つかいかた * 1. 型の扱いが面倒なので宣言はvarでやろう! * 2. 引数の数はコンパイル時にいい感じに処理してくれるぞ! * 3. オーバーヘッドとはおさらば! * (C) MIT License - 2024 GalaxyCat42 */ @SuppressWarnings("unused") abstract class IntArray { public final int[] ref; protected IntArray(int size) { this.ref = new int[size]; } public void fill(int value) { if (ref.length == 0) return; ref[0]=value; for (int len=1;len>1, mod); return (t*t)%mod; } static long modPow2(long a, long mod) { if (a <= 1) return a==1?2:a==0?1:0; if ((a&1) != 0) return (modPow2(a-1, mod)<<1)%mod; long t = modPow2(a>>1, mod); return (t*t)%mod; } static long modInv(long x, long mod) { return modPow(x, mod-2, mod); } static long modFrac(long a, long b, long mod) { return modInv(b, mod) * a % mod; } }