
main = do
  n <- getRows <$> getContents
  mapM_ print $ map (sum4 [0..9]) n

sum4 :: [Int] -> Int -> Int
sum4 xs n = length [(a,b,c,d) | a <- xs, b <- xs, c <- xs, d <- xs, a + b + c + d == n]

getRows s = map (read :: (String -> Int)) $ lines s