-- This is a source code template for Curry programs. max x y | x < y = y | otherwise = x -- data Pair a b = Pair a b -- data BinTree a = Leaf | Branch a (BinTree a) (BinTree a) -- type CacheTree = BinTree (Pair Int Int) calcCoin :: Int -> Int calcCoin 0 = 0 calcCoin x = max x (calcCoin(div x 4) + calcCoin(div x 3) + calcCoin(div x 2)) main = calcCoin 1