import java.util.Scanner; public class No632 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a[] = new int[3]; int b[] = new int[3]; for(int i = 0;i < 3;i++) { String c = sc.next(); if(c.equals("?")) { a[i] = 1; b[i] = 4; }else { a[i] = Integer.parseInt(c); b[i] = Integer.parseInt(c); } } if((a[1] < a[0] && a[1] < a[2]) || (a[1] > a[0] && a[1] > a[2])) { System.out.print(1); } if((b[1] < b[0] && b[1] < b[2]) || (b[1] > b[0] && b[1] > b[2])) { System.out.print(4); } System.out.println(); } }