#!perl -lp use Math'BigInt;map$a[$_]=Math'BigInt'bzero,!/ /..$';$a[$'-1]+=$';map{($a[$_-1]*=$'-$_+1)+=$a[$_]*$_}1..$' for 2..$`;$_=$a[0]