#!/usr/bin/perl
# Computes multinomial coeeficients. If a line containing x1...xN is read,
# then (x1+...+xN)! / x1! / ... / xN! is returned.
open(STDOUT, "|samuel -bZ") || die;
select(STDIN); $|=1; select(STDOUT); $|=1;
while (<STDIN>) {
	chop; s/^\s+//;
	@args = split;
	print "fact(",join("+",@args),")";
	foreach $x (@args) { print "/fact($x)"; }
	print ";\n";
}
close STDOUT;
