package com.javarush.task.task04.task0419;

/*
Максимум четырех чисел
*/

import java.io.*;

public class Solution {
    public static void main(String[] args) throws Exception {
        //напишите тут ваш код
    BufferedReader reader= new BufferedReader(new InputStreamReader(System.in));



    String q=reader.readLine();
   String w=reader.readLine();
  String e=reader.readLine();
  String t=reader.readLine();

    int aa=Integer.parseInt(q);
    int bb=Integer.parseInt(w);
    int cc=Integer.parseInt(e);
    int dd=Integer.parseInt(t);

    int a,b,r;

    if(aa<bb){
        a=bb;
    }
    else if(aa>=bb) {
         a=aa;
    }



    if(cc<dd){
        b=dd;
    }

    else if(cc>=dd) {
        b=cc;
    }

if(a<b){
        r=b;
    }
    else{
        r=a;
    }
    System.out.println(r);



    }
}