import java.util.*;
import java.io.*;
public class C{
    public static void main(String[] args)throws Exception{
        Scanner scan = new Scanner(System.in);
        //Scanner scan = new Scanner(new File("C.in"));
        int r = scan.nextInt();
        int c = scan.nextInt();
        long a =(long) ((Math.pow(2, c/2)+ (c%2)*(c/2+1))*2);
        System.out.print((long)(a%(1e9+7)));

    }
}