package yuki180 import java.util.Scanner object A { def kadomatsu(n1 :Int, n2: Int, n3: Int): Boolean = { if(n1 < n2 && n2 > n3) { return true } if(n1 > n2 && n2 < n3) { return true } return false } def main(args: Array[String]): Unit = { val sc = new Scanner(System.in) val c1, c2, c3 = sc.next() if(c1=="?") { val n2 = c2.toInt val n3 = c3.toInt if(kadomatsu(1, n2, n3)) { print(1) } if(kadomatsu(4, n2, n3)) { print(4) } } else if(c2=="?") { val n1 = c1.toInt val n3 = c3.toInt if(kadomatsu(n1, 1, n3)) { print(1) } if(kadomatsu(n1, 4, n3)) { print(4) } } else { val n1 = c1.toInt val n2 = c2.toInt if(kadomatsu(n1, n2, 1)) { print(1) } if(kadomatsu(n1, n2, 4)) { print(4) } } println() } }