Solve problems 56,97 using Scala.