import java.io.*;
import java.util.*;

public class Main {
    static int inf = (int) 1e9 + 7;

    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        pw = new PrintWriter(System.out);
        int n = nextInt();
        int m = nextInt();
        long ans1 = 1;
        if (n == 1) ans1 = 0;
        for(int i = 0;i < n - 2;i++) {
            ans1 = (ans1 * 2) % inf;
        }
        long ans2 = 1;
        if (m == 1) ans2 = 0;
        for(int i = 0;i < m - 2;i++) {
            ans2 = (ans2 * 2) % inf;
        }
        long ans3 = (ans1 + ans2 + 1) % inf;
        pw.println(ans3 * 2 % inf);
        pw.close();
    }

    static BufferedReader br;
    static StringTokenizer st = new StringTokenizer("");
    static PrintWriter pw;

    static String next() throws IOException {
        while (!st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

}