Scala: coin counting