main :: IO () main = interact $ solve . words solve :: [String] -> String solve (x:y:z) | x == "?" = if y == "2" then "4" else "1" | y == "?" = "14" | otherwise = if y == "2" then "4" else "1"