import java.io.*;
import java.util.*;
public class C {
	static int mod = 1000000007;
	public static void main(String[] args) throws Exception{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine() , " ");
		long n = Long.parseLong(st.nextToken());
		long m = Long.parseLong(st.nextToken());
		long oddC = 1, evenC = 1;
		for(int c = 1; c < m; ++c) {
			if(c % 2 == 0) {
				evenC = (evenC * 2) % mod;
			}else {
				oddC = (oddC  * 2 ) % mod;
			}
		}
		long oddR = 1, evenR = 1;
		for(int r = 1; r < n; ++r) {
			if(r % 2 == 0) {
				evenR = (evenR *  2) % mod;
			}else {
				oddR = ( oddR * 2) % mod;
			}
		}
		long ans = (((((evenC + oddC - 1 ) ) + evenR - 1 )  ) + oddR -1 ) % mod;
		ans = (ans * 2)%mod;
		System.out.println(ans);		
	}
}
