let L = int <| stdin.ReadLine() let M = int <| stdin.ReadLine() let N = int <| stdin.ReadLine() let money = Seq.zip [100;25;1;] [L;M;N] |> Seq.map (fun (a,b) -> a*b) |> Seq.reduce ((+)) let coins = [1000;100;25;1;] let rec f l m p = let a,b = m/coins.[p],m%coins.[p] if m - a*coins.[p] = 0 then l@[a] else f (l@[a]) (m-a*coins.[p]) (p+1) match f [] money 0 with | [] | [_] -> 0 | l -> l |> Seq.skip 1 |> Seq.reduce((+)) |> printfn "%d"