public class Solution { public static void main(String[] args) throws Exception { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); int a = Integer.parseInt(reader.readLine()); int b = Integer.parseInt(reader.readLine()); int c = Integer.parseInt(reader.readLine()); int d = Integer.parseInt(reader.readLine()); if (ab && b>c && c>d) System.out.println (a); if (ac && c>d) System.out.println (b); if (ad) System.out.println (c); if (a==b && b==c && c==d) System.out.println (a | b | c | d);