def func(x)
n=x/3
n+=1 if n*3!=x
r=1
while n>0
w=x/n
r*=w
x-=w
n-=1
end
r
end
p func(10)
p func(64)
p func(100)
p func(99) # 5559060566555523
ZGVmIGZ1bmMoeCkKCW49eC8zCgluKz0xIGlmIG4qMyE9eAoJcj0xCgl3aGlsZSBuPjAKCQl3PXgvbgoJCXIqPXcKCQl4LT13CgkJbi09MQoJZW5kCglyCmVuZAoKcCBmdW5jKDEwKQpwIGZ1bmMoNjQpCnAgZnVuYygxMDApCnAgZnVuYyg5OSkgIyA1NTU5MDYwNTY2NTU1NTIz