#include<bits/stdc++.h>
using namespace std;

const bool DEBUG = false;
const bool SHIT_DEBUG = true;

inline void add_x(const long long &dir, long long &x){
    if(dir>4)
        x--;
    else if(dir==2)
        x++;
    else if(dir%2)
        x++;
}

inline void add_y(const long long &dir, long long &y){
    if(dir<2)
        y++;
    else if(dir>2 && dir<6)
        y--;
}

inline bool inside(const long long &x, const long long &y, const long long &n, const long long &m){
    return (x>-1 && x<n && y>-1 && y<m);
}

long long mt[42][42][7];

inline void clear_mt(const long long &n, const long long &m){
    for(long long dir = 0; dir<7; dir++){
        for(long long i=0; i<n; i++){
            for(long long j=0; j<m; j++){
                mt[i][j][dir] = 0;
            }
        }
    }
}

inline void big_print(const long long &n, const long long &m){
    if(!DEBUG)
        return;
    for(long long dir = 0; dir<7; dir++){
        cout<<dir<<'\n';
        for(long long i=0; i<n; i++){
            for(long long j=0; j<m; j++){
                cout<<mt[i][j][dir]<<' ';
            }
            cout<<'\n';
        }
        cout<<'\n';
    }
}

long long calc(const long long &n, const long long &m){
    clear_mt(n, m);
    long long dir = 0;
    for(long long i=0; i<n; i++){
        for(long long j=0; j<1; j++){
            long long x=i, y=j;
            long long adder = i==0;
            add_x(dir, x);
            add_y(dir, y);
            if(DEBUG)
                cout<<dir<<'\n'<<i<<" : "<<j<<'\t'<<x<<" : "<<y<<"\nadding: "<<adder<<"\n\n";
            while(inside(x, y, n, m)){
                mt[x][y][dir] += adder;
                add_x(dir, x);
                add_y(dir, y);
            }
        }
    }

    dir++; //1
    for(long long i=1; i<n; i++){
        for(long long j=0; j<1; j++){
            long long x=i, y=j;
            long long adder1 = (dir>0 ? mt[i][j][dir-1] : 1);
            long long adder2 = (dir>1 ? mt[i][j][dir-2] : 0);
            long long adder3 = (dir>2 ? mt[i][j][dir-3] : 0);
            long long adder = adder1 + adder2 + adder3;
            add_x(dir, x);
            add_y(dir, y);
            if(DEBUG)
                cout<<dir<<'\n'<<i<<" : "<<j<<'\t'<<x<<" : "<<y<<"\nadding: "<<adder<<"\n\n";
            while(inside(x, y, n, m)){
                adder1 = (dir>0 ? mt[x][y][dir-1] : 0);
                adder2 = (dir>1 ? mt[x][y][dir-2] : 0);
                adder3 = (dir>2 ? mt[x][y][dir-3] : 0);
                mt[x][y][dir] += adder;
                add_x(dir, x);
                add_y(dir, y);
                adder+= adder1 + adder2 + adder3;
            }
        }
    }
    for(long long i=0; i<1; i++){
        for(long long j=0; j<m; j++){
            long long x=i, y=j;
            long long adder1 = (dir>0 ? mt[i][j][dir-1] : 1);
            long long adder2 = (dir>1 ? mt[i][j][dir-2] : 0);
            long long adder3 = (dir>2 ? mt[i][j][dir-3] : 0);
            long long adder = adder1 + adder2 + adder3;
            if(i==0 && j==0)
                adder++;
            add_x(dir, x);
            add_y(dir, y);
            if(DEBUG)
                cout<<dir<<'\n'<<i<<" : "<<j<<'\t'<<x<<" : "<<y<<"\nadding: "<<adder<<"\n\n";
            while(inside(x, y, n, m)){
                adder1 = (dir>0 ? mt[x][y][dir-1] : 0);
                adder2 = (dir>1 ? mt[x][y][dir-2] : 0);
                adder3 = (dir>2 ? mt[x][y][dir-3] : 0);
                mt[x][y][dir] += adder;
                add_x(dir, x);
                add_y(dir, y);
                adder+= adder1 + adder2 + adder3;
            }
        }
    }

    dir++; //2
    for(long long i=0; i<1; i++){
        for(long long j=0; j<m; j++){
            long long x=i, y=j;
            long long adder1 = (dir>0 ? mt[i][j][dir-1] : 1);
            long long adder2 = (dir>1 ? mt[i][j][dir-2] : 0);
            long long adder3 = (dir>2 ? mt[i][j][dir-3] : 0);
            long long adder = adder1 + adder2 + adder3;
            if(i==0 && j==0)
                adder++;
            add_x(dir, x);
            add_y(dir, y);
            if(DEBUG)
                cout<<dir<<'\n'<<i<<" : "<<j<<'\t'<<x<<" : "<<y<<"\nadding: "<<adder<<"\n\n";
            while(inside(x, y, n, m)){
                adder1 = (dir>0 ? mt[x][y][dir-1] : 0);
                adder2 = (dir>1 ? mt[x][y][dir-2] : 0);
                adder3 = (dir>2 ? mt[x][y][dir-3] : 0);
                mt[x][y][dir] += adder;
                add_x(dir, x);
                add_y(dir, y);
                adder+= adder1 + adder2 + adder3;
            }
        }
    }

dir++; //3
    for(long long i=1; i<n; i++){
        for(long long j=m-1; j<m; j++){
            long long x=i, y=j;
            long long adder1 = (dir>0 ? mt[i][j][dir-1] : 1);
            long long adder2 = (dir>1 ? mt[i][j][dir-2] : 0);
            long long adder3 = (dir>2 ? mt[i][j][dir-3] : 0);
            long long adder = adder1 + adder2 + adder3;
            add_x(dir, x);
            add_y(dir, y);
            if(DEBUG)
                cout<<dir<<'\n'<<i<<" : "<<j<<'\t'<<x<<" : "<<y<<"\nadding: "<<adder<<"\n\n";
            while(inside(x, y, n, m)){
                adder1 = (dir>0 ? mt[x][y][dir-1] : 0);
                adder2 = (dir>1 ? mt[x][y][dir-2] : 0);
                adder3 = (dir>2 ? mt[x][y][dir-3] : 0);
                mt[x][y][dir] += adder;
                add_x(dir, x);
                add_y(dir, y);
                adder+= adder1 + adder2 + adder3;
            }
        }
    }
    for(long long i=0; i<1; i++){
        for(long long j=0; j<m; j++){
            long long x=i, y=j;
            long long adder1 = (dir>0 ? mt[i][j][dir-1] : 1);
            long long adder2 = (dir>1 ? mt[i][j][dir-2] : 0);
            long long adder3 = (dir>2 ? mt[i][j][dir-3] : 0);
            long long adder = adder1 + adder2 + adder3;
            add_x(dir, x);
            add_y(dir, y);
            if(DEBUG)
                cout<<dir<<'\n'<<i<<" : "<<j<<'\t'<<x<<" : "<<y<<"\nadding: "<<adder<<"\n\n";
            while(inside(x, y, n, m)){
                adder1 = (dir>0 ? mt[x][y][dir-1] : 0);
                adder2 = (dir>1 ? mt[x][y][dir-2] : 0);
                adder3 = (dir>2 ? mt[x][y][dir-3] : 0);
                mt[x][y][dir] += adder;
                add_x(dir, x);
                add_y(dir, y);
                adder+= adder1 + adder2 + adder3;
            }
        }
    }

    dir++; //4
    for(long long i=0; i<n; i++){
        for(long long j=m-1; j<m; j++){
            long long x=i, y=j;
            long long adder1 = (dir>0 ? mt[i][j][dir-1] : 1);
            long long adder2 = (dir>1 ? mt[i][j][dir-2] : 0);
            long long adder3 = (dir>2 ? mt[i][j][dir-3] : 0);
            long long adder = adder1 + adder2 + adder3;
            add_x(dir, x);
            add_y(dir, y);
            if(DEBUG)
                cout<<dir<<'\n'<<i<<" : "<<j<<'\t'<<x<<" : "<<y<<"\nadding: "<<adder<<"\n\n";
            while(inside(x, y, n, m)){
                adder1 = (dir>0 ? mt[x][y][dir-1] : 0);
                adder2 = (dir>1 ? mt[x][y][dir-2] : 0);
                adder3 = (dir>2 ? mt[x][y][dir-3] : 0);
                mt[x][y][dir] += adder;
                add_x(dir, x);
                add_y(dir, y);
                adder+= adder1 + adder2 + adder3;
            }
        }
    }

    dir++; //5
    for(long long i=0; i<n-1; i++){
        for(long long j=m-1; j<m; j++){
            long long x=i, y=j;
            long long adder1 = (dir>0 ? mt[i][j][dir-1] : 1);
            long long adder2 = (dir>1 ? mt[i][j][dir-2] : 0);
            long long adder3 = (dir>2 ? mt[i][j][dir-3] : 0);
            long long adder = adder1 + adder2 + adder3;
            add_x(dir, x);
            add_y(dir, y);
            if(DEBUG)
                cout<<dir<<'\n'<<i<<" : "<<j<<'\t'<<x<<" : "<<y<<"\nadding: "<<adder<<"\n\n";
            while(inside(x, y, n, m)){
                adder1 = (dir>0 ? mt[x][y][dir-1] : 0);
                adder2 = (dir>1 ? mt[x][y][dir-2] : 0);
                adder3 = (dir>2 ? mt[x][y][dir-3] : 0);
                mt[x][y][dir] += adder;
                add_x(dir, x);
                add_y(dir, y);
                adder+= adder1 + adder2 + adder3;
            }
        }
    }
    for(long long i=n-1; i<n; i++){
        for(long long j=0; j<m; j++){
            long long x=i, y=j;
            long long adder1 = (dir>0 ? mt[i][j][dir-1] : 1);
            long long adder2 = (dir>1 ? mt[i][j][dir-2] : 0);
            long long adder3 = (dir>2 ? mt[i][j][dir-3] : 0);
            long long adder = adder1 + adder2 + adder3;
            add_x(dir, x);
            add_y(dir, y);
            if(DEBUG)
                cout<<dir<<'\n'<<i<<" : "<<j<<'\t'<<x<<" : "<<y<<"\nadding: "<<adder<<"\n\n";
            while(inside(x, y, n, m)){
                adder1 = (dir>0 ? mt[x][y][dir-1] : 0);
                adder2 = (dir>1 ? mt[x][y][dir-2] : 0);
                adder3 = (dir>2 ? mt[x][y][dir-3] : 0);
                mt[x][y][dir] += adder;
                add_x(dir, x);
                add_y(dir, y);
                adder+= adder1 + adder2 + adder3;
            }
        }
    }

    dir++; //6
    for(long long i=n-1; i<n; i++){
        for(long long j=0; j<m; j++){
            long long x=i, y=j;
            long long adder1 = (dir>0 ? mt[i][j][dir-1] : 1);
            long long adder2 = (dir>1 ? mt[i][j][dir-2] : 0);
            long long adder3 = (dir>2 ? mt[i][j][dir-3] : 0);
            long long adder = adder1 + adder2 + adder3;
            add_x(dir, x);
            add_y(dir, y);
            if(DEBUG)
                cout<<dir<<'\n'<<i<<" : "<<j<<'\t'<<x<<" : "<<y<<"\nadding: "<<adder<<"\n\n";
            while(inside(x, y, n, m)){
                adder1 = (dir>0 ? mt[x][y][dir-1] : 0);
                adder2 = (dir>1 ? mt[x][y][dir-2] : 0);
                adder3 = (dir>2 ? mt[x][y][dir-3] : 0);
                mt[x][y][dir] += adder;
                add_x(dir, x);
                add_y(dir, y);
                adder+= adder1 + adder2 + adder3;
            }
        }
    }
    big_print(n, m);

    return mt[0][0][6] + mt[0][0][5];
}

inline void shit_clear_mt(const long long &n, const long long &m, const long long &pos){
    for(long long dir = 0; dir<7; dir++){
        for(long long i=0; i<n; i++){
            for(long long j=0; j<m; j++){
                mt[i][j][dir] = 0;
            }
        }
    }
}

long long shit_calc(const long long &n, const long long &m, const long long &pos){
    shit_clear_mt(n, m, pos);
    long long dir = 0;
    for(long long i=0; i<n; i++){
        for(long long j=0; j<1; j++){
            long long x=i, y=j;
            long long adder = 0;
            add_x(dir, x);
            add_y(dir, y);
            if(DEBUG)
                cout<<dir<<'\n'<<i<<" : "<<j<<'\t'<<x<<" : "<<y<<"\nadding: "<<adder<<"\n\n";
            while(inside(x, y, n, m)){
                mt[x][y][dir] += adder;
                if(i==0 && y==pos)
                    adder = 1;
                add_x(dir, x);
                add_y(dir, y);
            }
        }
    }

    dir++; //1
    for(long long i=1; i<n; i++){
        for(long long j=0; j<1; j++){
            long long x=i, y=j;
            long long adder1 = mt[i][j][dir-1];
            long long adder = adder1;
            add_x(dir, x);
            add_y(dir, y);
            if(DEBUG)
                cout<<dir<<'\n'<<i<<" : "<<j<<'\t'<<x<<" : "<<y<<"\nadding: "<<adder<<"\n\n";
            while(inside(x, y, n, m)){
                mt[x][y][dir] += adder;
                add_x(dir, x);
                add_y(dir, y);
            }
        }
    }
    for(long long i=0; i<1; i++){
        for(long long j=0; j<m; j++){
            long long x=i, y=j;
            long long adder1 = (dir>0 ? mt[i][j][dir-1] : 1);
            long long adder2 = (dir>1 ? mt[i][j][dir-2] : 0);
            long long adder3 = (dir>2 ? mt[i][j][dir-3] : 0);
            long long adder = adder1 + adder2 + adder3;
            if(j == pos)
                adder++;
            add_x(dir, x);
            add_y(dir, y);
            if(DEBUG)
                cout<<dir<<'\n'<<i<<" : "<<j<<'\t'<<x<<" : "<<y<<"\nadding: "<<adder<<"\n\n";
            while(inside(x, y, n, m)){
                adder1 = (dir>0 ? mt[x][y][dir-1] : 0);
                adder2 = (dir>1 ? mt[x][y][dir-2] : 0);
                adder3 = (dir>2 ? mt[x][y][dir-3] : 0);
                mt[x][y][dir] += adder;
                add_x(dir, x);
                add_y(dir, y);
                adder+= adder1 + adder2 + adder3;
            }
        }
    }

    dir++; //2
    for(long long i=0; i<1; i++){
        for(long long j=0; j<m; j++){
            long long x=i, y=j;
            long long adder1 = (dir>0 ? mt[i][j][dir-1] : 1);
            long long adder2 = (dir>1 ? mt[i][j][dir-2] : 0);
            long long adder3 = (dir>2 ? mt[i][j][dir-3] : 0);
            long long adder = adder1 + adder2 + adder3;
            if(j==pos)
                adder++;
            add_x(dir, x);
            add_y(dir, y);
            if(DEBUG)
                cout<<dir<<'\n'<<i<<" : "<<j<<'\t'<<x<<" : "<<y<<"\nadding: "<<adder<<"\n\n";
            while(inside(x, y, n, m)){
                adder1 = (dir>0 ? mt[x][y][dir-1] : 0);
                adder2 = (dir>1 ? mt[x][y][dir-2] : 0);
                adder3 = (dir>2 ? mt[x][y][dir-3] : 0);
                mt[x][y][dir] += adder;
                add_x(dir, x);
                add_y(dir, y);
                adder+= adder1 + adder2 + adder3;
            }
        }
    }

    dir++; //3
    for(long long i=1; i<n; i++){
        for(long long j=m-1; j<m; j++){
            long long x=i, y=j;
            long long adder1 = (dir>0 ? mt[i][j][dir-1] : 1);
            long long adder2 = (dir>1 ? mt[i][j][dir-2] : 0);
            long long adder3 = (dir>2 ? mt[i][j][dir-3] : 0);
            long long adder = adder1 + adder2 + adder3;
            add_x(dir, x);
            add_y(dir, y);
            if(DEBUG)
                cout<<dir<<'\n'<<i<<" : "<<j<<'\t'<<x<<" : "<<y<<"\nadding: "<<adder<<"\n\n";
            while(inside(x, y, n, m)){
                adder1 = (dir>0 ? mt[x][y][dir-1] : 0);
                adder2 = (dir>1 ? mt[x][y][dir-2] : 0);
                adder3 = (dir>2 ? mt[x][y][dir-3] : 0);
                mt[x][y][dir] += adder;
                add_x(dir, x);
                add_y(dir, y);
                adder+= adder1 + adder2 + adder3;
            }
        }
    }
    for(long long i=0; i<1; i++){
        for(long long j=0; j<m; j++){
            long long x=i, y=j;
            long long adder1 = (dir>0 ? mt[i][j][dir-1] : 1);



            long long adder2 = (dir>1 ? mt[i][j][dir-2] : 0);

            long long adder3 = (dir>2 ? mt[i][j][dir-3] : 0);


            long long adder = adder1 + adder2 + adder3;
            add_x(dir, x);
            add_y(dir, y);
            if(DEBUG)
                cout<<dir<<'\n'<<i<<" : "<<j<<'\t'<<x<<" : "<<y<<"\nadding: "<<adder<<"\n\n";
            while(inside(x, y, n, m)){
                adder1 = (dir>0 ? mt[x][y][dir-1] : 0);
                adder2 = (dir>1 ? mt[x][y][dir-2] : 0);
                adder3 = (dir>2 ? mt[x][y][dir-3] : 0);
                mt[x][y][dir] += adder;
                add_x(dir, x);
                add_y(dir, y);
                adder+= adder1 + adder2 + adder3;
            }
        }
    }

    dir++; //4
    for(

        long long i=0; i<n; i++){
        for(long long j=m-1; j<m; j++){
            long long x=i, y=j;
            long long adder1 = (dir>0 ? mt[i][j][dir-1] : 1);
            long long adder2 = (dir>1 ? mt[i][j][dir-2] : 0);
            long long adder3 = (dir>2 ? mt[i][j][dir-3] : 0);
            long long adder = adder1 + adder2 + adder3;
            add_x(dir, x);
            add_y(dir, y);
            if(DEBUG)
                cout<<dir<<'\n'<<i<<" : "<<j<<'\t'<<x<<" : "<<y<<"\nadding: "<<adder<<"\n\n";
            while(inside(x, y, n, m)){
                adder1 = (dir>0 ? mt[x][y][dir-1] : 0);
                adder2 = (dir>1 ? mt[x][y][dir-2] : 0);
                adder3 = (dir>2 ? mt[x][y][dir-3] : 0);
                mt[x][y][dir] += adder;
                add_x(dir, x);
                add_y(dir, y);
                adder+= adder1 + adder2 + adder3;
            }
        }
    }

    dir++; //5
    for(long long i=0; i<n-1; i++){
        for(long long j=m-1; j<m; j++){
            long long x=i, y=j;
            long long adder1 = (dir>0 ? mt[i][j][dir-1] : 1);
            long long adder2 = (dir>1 ? mt[i][j][dir-2] : 0);
            long long adder3 = (dir>2 ? mt[i][j][dir-3] : 0);
            long long adder = adder1 + adder2 + adder3;
            add_x(dir, x);
            add_y(dir, y);
            if(DEBUG)
                cout<<dir<<'\n'<<i<<" : "<<j<<'\t'<<x<<" : "<<y<<"\nadding: "<<adder<<"\n\n";
            while(inside(x, y, n, m)){
                adder1 = (dir>0 ? mt[x][y][dir-1] : 0);
                adder2 = (dir>1 ? mt[x][y][dir-2] : 0);
                adder3 = (dir>2 ? mt[x][y][dir-3] : 0);
                mt[x][y][dir] += adder;
                add_x(dir, x);
                add_y(dir, y);
                adder+= adder1 + adder2 + adder3;
            }
        }
    }
    for(long long i=n-1; i<n; i++){
        for(long long j=0; j<m; j++){
            long long x=i, y=j;
            long long adder1 = (dir>0 ? mt[i][j][dir-1] : 1);
            long long adder2 = (dir>1 ? mt[i][j][dir-2] : 0);
            long long adder3 = (dir>2 ? mt[i][j][dir-3] : 0);
            long long adder = adder1 + adder2 + adder3;
            add_x(dir, x);
            add_y(dir, y);
            if(DEBUG)
                cout<<dir<<'\n'<<i<<" : "<<j<<'\t'<<x<<" : "<<y<<"\nadding: "<<adder<<"\n\n";
            while(inside(x, y, n, m)){
                adder1 = (dir>0 ? mt[x][y][dir-1] : 0);
                adder2 = (dir>1 ? mt[x][y][dir-2] : 0);
                adder3 = (dir>2 ? mt[x][y][dir-3] : 0);
                mt[x][y][dir] += adder;
                add_x(dir, x);
                add_y(dir, y);
                adder+= adder1 + adder2 + adder3;
            }
        }
    }

    dir++; //6
    for(long long i=n-1; i<n; i++){
        for(long long j=0; j<m; j++){


            long long x=i, y=j;


            long long adder1 = (dir>0 ? mt[i][j][dir-1] : 1);

            long long adder2 = (dir>1 ? mt[i][j][dir-2] : 0);


            long long adder3 = (dir>2 ? mt[i][j][dir-3] : 0);
            long long adder = adder1 + adder2 + adder3;
            add_x(dir, x);
            add_y(dir, y);
            if(DEBUG)
                cout<<dir<<'\n'<<i<<" : "<<j<<'\t'<<x<<" : "<<y<<"\nadding: "<<adder<<"\n\n";
            while(inside(x, y, n, m)){
                adder1 = (dir>0 ? mt[x][y][dir-1] : 0);
                adder2 = (dir>1 ? mt[x][y][dir-2] : 0);
                adder3 = (dir>2 ? mt[x][y][dir-3] : 0);
                mt[x][y][dir] += adder;
                add_x(dir, x);
                add_y(dir, y);
                adder+= adder1 + adder2 + adder3;
            }
        }
    }
    big_print(n, m);

    return mt[pos][0][6] + mt[pos][0][5] + mt[pos][0][4];
}

void test_calc(){
    long long i, j, k;
    cin>>i>>j;//>>k;
    while(i!=-1 && j!=-1){
        cout<<'\n'<<calc(i, j)<<"\n\n";
        cin>>i>>j;//>>k;
    }
}

void shit_test(){
    if(!SHIT_DEBUG)
        return;
    for(int i=1; i<20; i++){
        for(int j=1; j<20; j++){
            cout<<calc(i, j)<<' ';
        }
        cout<<'\n';
    }
    cout<<'\n';
}

int main(){
    //shit_test();
    //test_calc();
    //return 0;
    long long ans = 0;
    long long n, m;
    cin>>n>>m;
    for(long long i=1; i<=n; i++){
        for(long long j=1; j<=m; j++){
            ans += calc(i, j);
            for(long long k=1; k<=min(i, j); k++)
                ans+=shit_calc(i, j, k);
        }
    }
    cout<<ans;
    return 0;
}
