import java.util.*; class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { String s = sc.nextLine().replace(" ",""); String one = s.replace("?","1"); String four = s.replace("?","4"); String ans = ""; if (one.charAt(0)one.charAt(2) || one.charAt(0)>one.charAt(1)&&one.charAt(1)four.charAt(2) || four.charAt(0)>four.charAt(1)&&four.charAt(1)