using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Program { class Program { static void Main(string[] args) { string[] list = Console.ReadLine().Split(); string output = null; //?=1の場合 for (int i = 0; i < 3; ++i) { if (String.Compare(list[i],"?",true) == 0) { list[i] = "1"; } } int x1 = int.Parse(list[0]); int x2 = int.Parse(list[1]); int x3 = int.Parse(list[2]); if ((x2 > x1 && x2 > x3) || (x2 < x1 && x2 < x3)) { output = "1"; } //?=4の場合 for (int i = 0; i < 3; ++i) { if (String.Compare(list[i], "?", true) == 0) { list[i] = "4"; } } int x4 = int.Parse(list[0]); int x5 = int.Parse(list[1]); int x6 = int.Parse(list[2]); if ((x5 > x4 && x5 > x6) || (x5 < x4 && x5 < x6)) { output = "4"; } Console.WriteLine(output); Console.WriteLine(); } } }