program sample
	integer ::A,B,C,D,e,f
    
    read(*,*) A
    read(*,*) B    
    read(*,*) C    
    read(*,*) D    
    
    if (A>B) then
    	e=B
    else if(B<=A) then
    	e=A
    end if
    if(C>D) then
    	f=D
    else if(C<=D) then
    	f=C
    end if
    write(*,*) e+f
    stop
end program sample