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

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String parr[] =  br.readLine().split("\\s+");
        int[] arr = new int[parr.length];
        long ans = 0;
        for(int i = 0 ; i < arr.length ; i++) {
            arr[i] = Integer.valueOf(parr[i]);
        }
        
        int r = arr[0];
        int c = arr[1];
        
        byte[][] grid = new byte[r][c];
        ans = build(grid, 0, 0);
        if(1000000007 - ans <= ans) {
            ans = (long)ans - 1000000007 + ans;
        }
        else {
            ans =(long) ans + ans;
        }
        System.out.println(ans);
    }
    private static boolean isValid(byte[][] grid, int r, int c) {
        if(r < 0 || c < 0 || r >= grid.length || c >= grid[0].length)
            return true;
        int color = grid[r][c];
        int count = 0;
        if(r - 1 >= 0 && grid[r - 1][c] == color)
            count++;
        if(r + 1 < grid.length && grid[r + 1][c] == color)
            count++;
        if(c - 1 >= 0 && grid[r][c - 1] == color)
            count++;
        if(c + 1 < grid[0].length && grid[r][c + 1] == color)
            count++;
            
        if(count > 1)
            return false;
        return true;
    }
    
    public static long build(byte[][] grid, int r, int c) {
        if(r < 0 || c < 0 || r >= grid.length || c >= grid[0].length)
            return 0;
            
        if(r == grid.length - 1 && c == grid[0].length - 1) {
            int ans = 0;
            grid[r][c] = 1;
            if(isValid(grid, r, c) && isValid(grid, r-1, c) && isValid(grid, r, c-1)) {
                ans++;
            }
            grid[r][c] = 0;
            grid[r][c] = 2;
            if(isValid(grid, r, c) && isValid(grid, r-1, c) && isValid(grid, r, c-1)) {
                ans++;
            }
            grid[r][c] = 0;
            return ans;
        }
        long ans = 0;
        grid[r][c] = 1;
        if(isValid(grid, r, c) && isValid(grid, r-1, c) && isValid(grid, r, c-1)) {
            if(c + 1 == grid[0].length)
                ans += build(grid, r + 1 , 0 ) % 1000000007;
            else
                ans += build(grid, r , c + 1 ) % 1000000007;
        }
        grid[r][c] = 0;
        grid[r][c] = 2;
        if((r != 0 || c != 0) && isValid(grid, r, c) && isValid(grid, r-1, c) && isValid(grid, r, c-1)) {
            if(c + 1 == grid[0].length)
                ans += build(grid, r + 1 , 0 ) % 1000000007;
            else
                ans += build(grid, r , c + 1 ) % 1000000007;
        }
        grid[r][c] = 0;
        return ans;
    }
    
}