import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CIvanTheFoolAndTheProbabilityTheory solver = new CIvanTheFoolAndTheProbabilityTheory();
        solver.solve(1, in, out);
        out.close();
    }

    static class CIvanTheFoolAndTheProbabilityTheory {
        static int r;
        static int c;
        static int mod = (int) 1e9 + 7;
        static Integer memo[][][];

        public void solve(int testNumberr, Scanner sc, PrintWriter pw) {
            r = sc.nextInt();
            c = sc.nextInt();
            memo = new Integer[3][3][c + 1];
            pw.println((dp(0, 0, 0) + (r == 2 ? 2 : 0)) % mod);
        }

        private int dp(int i, int white, int black) {
            if (i == c)
                return 1;
            if (memo[white][black][i] != null)
                return memo[white][black][i];
            int blackk = 0, whitee = 0;
            if (black < 2)
                blackk = dp(i + 1, 0, black + 1);
            if (white < 2)
                whitee = dp(i + 1, white + 1, 0);
            return memo[white][black][i] = ((blackk + whitee) % mod);
        }

    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(FileReader r) {
            br = new BufferedReader(r);
        }

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

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

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

    }
}

