program main
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int32)::a,b,c,d
    read*, a
    read*, b
    read*, c
    read*, d

    print'(i0)', min(a,b)+min(c,d)
end program main