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

public class C {
    static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
    static MyScanner sc;

    static {
        try {
            sc = new MyScanner();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        doTask();
        out.flush();
    }

    public static void doTask(){
        int n = sc.nextInt(), m = sc.nextInt();
        int max = Math.max(n,m), min = Math.min(n,m);
        if (min >3) {
            out.println(2);
        } else {
            long[][] d = new long[max+1][2];
            int black = 0, white = 1;
            long base = min == 2 ? 2 : 0; // Same values in vertical lines case
            long MOD = 1_000_000_007;
            d[0][black] = 0;
            d[0][white] = 0;
            d[1][black] = 1;
            d[1][white] = 0;

            for (int i=2; i<=max; i++) {
                d[i][black] = (d[i-1][black] + d[i-1][white] - d[i-2][black])%MOD;
                d[i][white] = (d[i-1][white] + d[i-1][black] - d[i-2][white])%MOD;
            }

            long additional = ((d[max][black]+d[max][white])*2)%MOD;

            long result = (base + additional)%MOD;
            out.println(result);
        }
    }

    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() throws FileNotFoundException {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

        double nextDouble() {
            return Double.parseDouble(next());
        }

        Long[] nextLongArr(int n) {
            Long[] r = new Long[n];
            for (int i=0; i<n; i++) {
                r[i] = sc.nextLong();
            }
            return r;
        }

        String nextLine(){
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

    }

    static class Pair {
        Pair(int cx, int cy) {
            x = cx; y = cy;
        }
        long x,y;
    }
}
