import scala.io.StdIn object Main { def main(args: Array[String]): Unit = { val n = StdIn.readLine().toArray val sz = n.size var ans: Long = 0 for (i <- (0 until sz); j <- (i until sz)) { val tmp = n.clone val ch = tmp(i) tmp(i) = tmp(j) tmp(j) = ch ans = Math.max(ans, tmp.mkString.toLong) } println(ans) } }