#define _USE_MATH_DEFINES
#include  <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include <stdlib.h>
#include<stdio.h>
#include <queue>
#include<map>
#include <sstream>
#include<set>
#include<stack>
#include<time.h>
#include <sys/types.h>
#include <tuple>


typedef long long int ll;
//#include<bits/stdc++.h>


using namespace std;



int main()
{

    int Q;
    Q = 1;
    //cin >> Q;
    
    
    
    while (Q--) {

        ll a, b;
        cin >> a >> b;
        ll x = 0;
        for (int i = 0; i <= 8; i++) {
            if (a & (1 << i))x |= (1 << i);
            if (b & (1 << i))x |= (1 << i);

        }
        ll ans = 1;
        for (int i = 1; i <= x; i++) {
            ans *= i;
        }
        cout << ans << endl;
    }
    return 0; 
}