#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()
{
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxsaW1pdHMuaD4KI2RlZmluZSBJTkYgVUlOVF9NQVgKCmxvbmcgbG9uZyB1bnNpZ25lZCBmYWN0KHVuc2lnbmVkIG4pCnsKICAgIHJldHVybiBuID8gbiAqIGZhY3Qobi0xKSA6IDE7Cn0KCnVuc2lnbmVkIEModW5zaWduZWQgbiwgdW5zaWduZWQgaykKewogICAgcmV0dXJuIGZhY3QobikvKGZhY3QoaykgKiBmYWN0KG4taykpOwp9Cgp1bnNpZ25lZCBGKHVuc2lnbmVkIE4sIHVuc2lnbmVkIEwsIHVuc2lnbmVkIFIpCnsKICAgIHVuc2lnbmVkIHBvcywgc3VtID0gMDsKICAgIGlmKFIgIT0gSU5GKQogICAgewogICAgICAgIGlmKEwgPT0gMCB8fCBSID09IDAgfHwgTiA8IEwgfHwgTiA8IFIpIHJldHVybiAwOwogICAgICAgIGlmKEwgPT0gMSkgcmV0dXJuIEYoTi0xLCBSLTEsIElORik7CiAgICAgICAgaWYoUiA9PSAxKSByZXR1cm4gRihOLTEsIEwtMSwgSU5GKTsKICAgICAgICBmb3IocG9zID0gTDsgcG9zIDw9IE4tUisxOyAr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