import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;

public class Task1248C {

    public static class FastScanner {

        protected static final int STRBUFFERLENGTH = 0x1000;

        protected DataInputStream dataInputStream;
        protected byte[] buffer = new byte[0x10000];
        protected byte[] strbuffer = new byte[STRBUFFERLENGTH];
        protected int bufferOffset;
        protected int bufferLength;
        protected boolean isEndOfFile;

        public FastScanner() throws IOException {
            dataInputStream = new DataInputStream(System.in);
            Read();
        }

        public FastScanner(final String fileName) throws IOException {
            dataInputStream = new DataInputStream(new FileInputStream(fileName));
            Read();
        }

        protected void Read() throws IOException {
            final int length = dataInputStream.read(buffer);
            if (length > 0) {
                bufferLength = length;
            } else {
                bufferLength = 0;
                isEndOfFile = true;
            }
            bufferOffset = 0;
        }

        protected byte nextByte() throws IOException {
            if (bufferOffset == bufferLength) {
                if (!isEndOfFile) Read();
                if (isEndOfFile) return 0;
            }
            return buffer[bufferOffset++];
        }

        public int nextInt() throws IOException {
            int a = 0;
            boolean isNegative = false;

            byte b = nextByte();
            while (b <= ' ') b = nextByte();
            if (b == '-') {
                isNegative = true;
                b = nextByte();
            }
            while (b > ' ') {
                a = a * 10 + (b - '0');
                b = nextByte();
            }
            return isNegative ? -a : a;
        }

    }

    public static final long MODULUS = 1000000007L;

    public static class Variants {
        public int key;
        public long num;
        public long[][] n = new long[4][4];
    }

    public static HashMap<Integer, Variants> variants = new HashMap<Integer, Variants>();
    public static final Integer[] POW2 = {65536, 32768, 16384, 8192, 4096, 2048, 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1};
    public static List<Integer> pow2 = Arrays.asList(POW2);

    public static final int B = 0;
    public static final int W = 1;
    public static final int BB = 2;
    public static final int WW = 3;

    static {
        final Variants v = new Variants();
        v.key = 1;
        v.num = 2;
        v.n[B][B] = v.n[W][W] = 1;
        variants.put(1, v);
    }

    public static Variants GetMultiVariants(final Variants v1, final Variants v2) {
        final Variants v = new Variants();
        for (int i1 = 0; i1 < 4; i1++) {
            for (int i2 = 0; i2 < 4; i2++) {
                if (i1 == W && i2 == W) {
                    // стыковка разрешена, но при стыковке справа с единицей получаем WW в конце
                    if (v1.key == 1 && v2.key == 1) {
                        v.n[WW][WW]++;
                    } else if (v2.key == 1) {
                        for (int i = 0; i < 4; i++) v.n[i][WW] += v1.n[i][W];
                    } else {
                        for (int i = 0; i < 4; i++) for (int j = 0; j < 4; j++) v.n[i][j] += v1.n[i][i1] * v2.n[i2][j];
                    }
                } else if (i1 == B && i2 == B) {
                    // стыковка разрешена, но при стыковке справа с единицей получаем BB в конце
                    if (v1.key == 1 && v2.key == 1) {
                        v.n[BB][BB]++;
                    } else if (v2.key == 1) {
                        for (int i = 0; i < 4; i++) v.n[i][BB] += v1.n[i][B];
                    } else {
                        for (int i = 0; i < 4; i++) for (int j = 0; j < 4; j++) v.n[i][j] += v1.n[i][i1] * v2.n[i2][j];
                    }
                } else if ((i1 == WW && i2 == W) || (i1 == W && i2 == WW) || (i1 == WW && i2 == WW)
                        || (i1 == B && i2 == BB) || (i1 == BB && i2 == B) || (i1 == BB && i2 == BB)) {
                    // не состыкуются - ничего не деляем
                } else {
                    // состыкуются - обычное суммирование вариантов
                    for (int i = 0; i < 4; i++) for (int j = 0; j < 4; j++) v.n[i][j] += v1.n[i][i1] * v2.n[i2][j];
                }
            }
        }
        for (int i = 0; i < 4; i++) for (int j = 0; j < 4; j++) v.n[i][j] %= MODULUS;
        for (int i = 0; i < 4; i++) for (int j = 0; j < 4; j++) v.num += v.n[i][j];
        v.num %= MODULUS;
        return v;
    }

    public static Variants GetVariants(final int n) {
        if (variants.containsKey(n)) return variants.get(n);
        if (pow2.contains(n)) {
            final Variants v = GetVariants(n/2);
            final Variants v2 = GetMultiVariants(v, v);
            v2.key = n;
            variants.put(n, v2);
            return v2;
        } else {
            Variants v = new Variants();
            boolean firstPower = true;
            for (final int pow : pow2) {
                if ((n & pow) > 0) {
                    if (firstPower) {
                        v = GetVariants(pow);
                        firstPower = false;
                    } else {
                        v = GetMultiVariants(v, GetVariants(pow));
                    }
                }
            }
            return v;
        }
    }

    public static long GetNumVariants(final int N) {
        return GetVariants(N).num;
    }

    public static void main(final String[] args) throws IOException {
        final FastScanner scanner = new FastScanner();

        final int n = scanner.nextInt();
        final int m = scanner.nextInt();

        long numVariants = GetNumVariants(m);
        numVariants += MODULUS - 2;
        numVariants %= MODULUS;

        numVariants += GetNumVariants(n);
        numVariants %= MODULUS;

        System.out.println(numVariants);
    }

}
