k=eval *$< p [*1..8].permutation.count{_1.join.to_i%k<1}