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


public class ivanTheFool {
    public static long mod = 1000000000+7;
    public static void fout(long x){
        System.out.println(x);
    }
    /**-----------fast reader------------*/
    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; 
        } 
    } 
    /**-----end of fast reader----------------*/

    public static long pmod(long  x,long  y){
        long r = 1;
        while(y > 0){
            if(y%2 == 1){
                r = (r * x)%mod;
            }
            x = (x * x)%mod;
            y >>= 1;
        }
        return r;
    }

    public static void main(String[] args) {
        FastReader rd = new FastReader();
        long n,m;
        n = rd.nextLong();
        m = rd.nextLong();
        long answer = 0;
        long []fact = new long[(int)Math.max(n,m)+1];
        fact[0] = 1;
        for(long i = 1;i<=Math.max(n,m);++i){
            fact[(int)i] = (fact[(int)i-1]*i)%mod;
        }
        answer += 2;//all adj cells are different
        if(m >= 2){
            long pillars = -1;
            long blocksOf2 = 0;
            for(long blocks = 2;blocks <= m;blocks+=3){
                pillars += 1;
                blocksOf2 += 1;
                long obj = m - (blocksOf2*2) - pillars;
                long bins = blocksOf2+pillars+1;
                if(bins+obj-1 < obj) break;
                answer = (answer + (2*(fact[(int)(bins+obj-1)] * pmod(fact[(int)obj],mod-(long)2)))%mod)%mod;
            }
        }
        if(n >= 2){
            long pillars = -1;
            long blocksOf2 = 0;
            for(long blocks = 2;blocks <= n;blocks+=3){
                pillars += 1;
                blocksOf2 += 1;
                long obj = n - (blocksOf2*2) - pillars;
                long bins = blocksOf2+pillars+1;
                if(bins+obj-1 < obj) break;
                answer = (answer + (2*(fact[(int)(bins+obj-1)] * pmod(fact[(int)obj],mod-(long)2)))%mod)%mod;
            }
        }
        if(m == 1 ^ n == 1){
            answer = (answer + 2)%mod;
        }
        fout(answer);
    }
}