Add reverse element in Scala