input = raw_input
n, m = map(int, input().split(" "))

if n >= 2 and m >= 2:
    #c = [2 for i in range(n+1)]
    #t = [2 for i in range(n+1)]
    #y = [2 for i in range(n+1)]
    #T2 = [2 for i in range(n+1)]
    c = t = y = 2
    T2 = 2
    for i in range(3, n+1):
        #c[i] = c[i-1] + y[i-1]
        #y[i] = c[i-1]
        cn = c+ y
        yn = c

        c, y = cn, yn

        #T2[i] = c[i] + y[i] - 2
        T2 = c + y - 2

    #Cn = [2 for i in range(m+1)]
    #Tn = [T2[n] for i in range(m+1)]
    #Yn = [2 for i in range(m+1)]

    Tn = T2
    Cn = 2
    Yn = 2

    for j in range(3, m+1):
        #Cn[j] = Yn[j-1] + Cn[j-1]
        #Yn[j] = Cn[j-1]
        Cn_next = Yn + Cn
        Yn_next = Cn
        Cn, Yn = Cn_next, Yn_next

    #out = Cn[m] + Yn[m] + Tn[m]
    out = Cn + Yn + Tn

elif n == 1 and m == 1:
    out = 2
else:
    n = max(n, m)
    #b1 = [0 for i in range(n+1)]
    #b2 = [0 for i in range(n+1)]
    #w1 = [0 for i in range(n+1)]
    #w2 = [0 for i in range(n+1)]
    #b1[1] = 1
    #w1[1] = 1
    b1 = 1
    b2 = 0
    w1 = 1
    w2 = 0

    for i in range(2, n+1):
        b1n = w1 + w2
        b2n = b1
        w1n = b1 + b2
        w2n = w1
        b1, b2, w1, w2 = b1n, b2n, w1n, w2n
        #b1[i] = w1[i-1] + w2[i-1]
        #b2[i] = b1[i-1]
        #w1[i] = b1[i-1] + b2[i-1]
        #w2[i] = w1[i-1]
    #out = b1[n] + b2[n] + w1[n] + w2[n]
    out = b1 + b2 + w1 + w2

print(out)