read a b c k

min() {
	min=$1
    shift
    
    for i in $@
    do
    	if (( "$i" < "$min" )); then
        	min=$i
        fi
    done
    
    echo "$min"
}

echo $(( "$(min "$a" "$k")" - ("$k" - "$a" - "$b") ))
