using System; using System.Linq; using System.Collections.Generic; static class NagataKanaIsAGenius { public static void Main() { char[]s=Console.ReadLine().ToArray(); if(s.Length==2&&s[1]=='0'){ Console.WriteLine(-1); Environment.Exit(0); } Array.Sort(s); Array.Reverse(s); s[s.Length-2]^=s[s.Length-1]; s[s.Length-1]^=s[s.Length-2]; s[s.Length-2]^=s[s.Length-1]; foreach(char c in s){ Console.Write(c); } Console.WriteLine(""); } }