//package div3;

import java.io.*;
import java.util.List;
import java.util.StringTokenizer;

public class board
{
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            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());
        }

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

    static void print(List<Integer> l){
        for(int ele:l){
            System.out.print(ele+" ");
        }
        System.out.println();
    }
    static Integer[][][] dp;
    static int mod = (int)(1e9+7);
    static int add(int a,int b){
        return (a%mod+b%mod)%mod;
    }
    static int mul(int a,int b){
        return (a%mod * b%mod)%mod;
    }
    private static int go(int blacks,int whites,int index,int m){
        if(index >= m)return 1;
        if(dp[index][blacks][whites] != null)return dp[index][blacks][whites];
        int count = 0;
        //System.out.println(blacks+" "+whites);
        if(blacks >= 2){
            count = add(count,go(0,1,index+1,m));
        }
        else if(whites >= 2){
            count = add(count,go(1,0,index+1,m));
        }
        else{
            count = add(go(blacks+1,0,index+1,m) , go(0,whites+1,index+1,m));
        }

        return dp[index][blacks][whites] = count;
    }
    public static void main(String[] args)
    {
        FastReader sc=new FastReader();
        PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
        //int t  = sc.nextInt();


        int n = sc.nextInt();
        int m = sc.nextInt();
        dp = new Integer[m][4][4];
        int[] pow = new int[n+1];
        int[] cal = new int[m+1];

        cal[1] = 2;
        if(m>=2)
        cal[2] = 4;
        for(int i=3;i<=m;i++){
            cal[i] = add(cal[i-1],cal[i-2]);
        }
        pow[0] = 1;
        for(int i=1;i<=n;i++){
            pow[i] = mul(pow[i-1],2);
        }
        int ways = cal[m];
        //System.out.println(go(0,0,0,m));
        //System.out.println(ways+" "+pow[n]);
        System.out.println((ways-2) + (pow[n]));

        //out.close();

    }
}