r=1;t=0 gets.chomp.bytes.group_by{|e|e}.map{|k,v|v.size.times{|i|r=r*(t+=1)/(i+1)}} p -~r%573