In \triangle ABC, we have AB = AC = 4 and \angle BAC = 45^\circ. If M is the midpoint of BC, then find AM^2.