A semicircle with diameter \(d\) is contained in a square whose sides have length 8. Given the maximum value of \(d\) is \(m - \sqrt{n},\) find \(m+n.\)

(第二十三届AIME1 2005 第11题)