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.InputStreamReader;
import java.io.InputStream;

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

    static class TaskC {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();
            if (n == 1) {
                out.println(fib(m + 1));
//            System.out.println(fib(m) + " " + fib(m - 1));
                return;
            } else if (m == 1) {
                out.println(fib(n + 1));
                return;
            } else {
                int ans = 4;
                ans += (n + m - 3) * 2;
                out.println(ans);
            }
        }

        int fib(int n) {
            int F[][] = new int[][]{{1, 1}, {1, 0}};
            if (n == 0)
                return 0;
            power(F, n - 1);

            return F[0][0];
        }

        void multiply(int F[][], int M[][]) {
            int x = F[0][0] * M[0][0] + F[0][1] * M[1][0];
            int y = F[0][0] * M[0][1] + F[0][1] * M[1][1];
            int z = F[1][0] * M[0][0] + F[1][1] * M[1][0];
            int w = F[1][0] * M[0][1] + F[1][1] * M[1][1];

            F[0][0] = x;
            F[0][1] = y;
            F[1][0] = z;
            F[1][1] = w;
        }

        void power(int F[][], int n) {
            if (n == 0 || n == 1)
                return;
            int M[][] = new int[][]{{1, 1}, {1, 0}};

            power(F, n / 2);
            multiply(F, F);

            if (n % 2 != 0)
                multiply(F, M);
        }

    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader(InputStream i) {
            br = new BufferedReader(new
                    InputStreamReader(i));
        }

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

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

    }
}

