program ABC_092_A_TravelingBudget
   implicit none
   integer(8) A, B, C, D
   read(*, *) A
   read(*, *) B
   read(*, *) C
   read(*, *) D
    if(A < B) then
	   if(C < D) then
	       write(*, *) A + C
	   else 
	       write(*, *) A + D	      
       end if
    else 
	   if(C < D) then
	       write(*, *) B + C
	   else 
	       write(*, *) B + D
	   end if
	end if
end program ABC_092_A_TravelingBudget