import java.util.*;
public class MyClass {
  static int M=1000000007;
  static int pow(int x,int n)
  {
      if(n==0)
        return 1;
    else if(n%2 == 0)       
        return pow((x*x)%M,n/2);
    else                            
        return (x*pow((x*x)%M,(n-1)/2))%M;
  }
    public static void main(String args[]) {
      Scanner in=new Scanner(System.in);
      int n=in.nextInt();
      int m=in.nextInt();
      int ans;
      if(n==1&&m==1) ans=2;
      else{
      n=(n-1)/2;
      m=(m-1)/2;
      ans=(4*pow(2,n+m))%M;
      }System.out.println(ans);
    }
}