#include <stdio.h>
#include <limits.h>
#define INF UINT_MAX

long long unsigned fact(unsigned n)
{
    return n ? n * fact(n-1) : 1;
}

unsigned C(unsigned n, unsigned k)
{
    return fact(n)/(fact(k) * fact(n-k));
}

unsigned F(unsigned N, unsigned L, unsigned R)
{
    unsigned pos, sum = 0;
    if(R != INF)
    {
        if(L == 0 || R == 0 || N < L || N < R) return 0;
        if(L == 1) return F(N-1, R-1, INF);
        if(R == 1) return F(N-1, L-1, INF);
        for(pos = L; pos <= N-R+1; ++pos)
            sum += C(N-1, pos-1) * F(pos-1, L-1, INF) * F(N-pos, R-1, INF);
    }
    else
    {
        if(L == 1) return fact(N-1);
        for(pos = L; pos <= N; ++pos)
            sum += C(N-1, pos-1) * F(pos-1, L-1, INF) * fact(N-pos);
    }
    return sum;
}

int main()
{
    printf("%u\n", F(10,4,3));
    return 0;
}
