import Data.List main = getLine >>= print . (`mod` 573) . pred . solve solve :: String -> Integer solve xs = product [2..len] `div` (product . map (product . (\x -> [2..(genericLength x)])) . group . sort) xs where len = genericLength xs