#include <cstdio>  
#include <cstring>  
#include <cstdlib>  
#include <iostream>
#include <algorithm>
using namespace std;
   
int main() {  
  int ans[7][8] = {  
    {0, 0, 0, 0, 0, 0, 0, 0},{0, 0, 1, 2, 3, 4, 5, 6},  
    {0, 0, 6, 15, 28, 45, 66, 91}, {0, 0, 0, 52, 143, 350, 799, 1744},  
    {0, 0, 0, 0, 614, 2431, 9184, 33603},{0, 0, 0, 0, 0, 16000, 102147, 637330},  
    {0, 0, 0, 0, 0, 0, 1114394, 11948355} };   
    int a,b; 
    scanf("%d%d",&a,&b);
    if(a>b)swap(a,b);
    printf("%d\n", ans[a][b]);  
    return 0;  
}