using System; namespace y { class Program { static void Main(string[] args) { string s = Console.ReadLine().Replace(" ",""); string a = s.Replace("?", "1"); string b = s.Replace("?", "4"); if ((a[0] < a[1] && a[1] > a[2]) || (a[0] > a[1] && a[1] < a[2])) Console.Write("1"); if ((b[0] < b[1] && b[1] > b[2]) || (b[0] > b[1] && b[1] < b[2])) Console.Write("4"); Console.WriteLine(); } } }