change log(m+n) to basic solution
add log(min(m,n)) sol