Let A_{1} A_{2} A_{3} A_{4} A_{5} A_{6} A_{7} A_{8} be a regular octagon. Let M_{1}, M_{3}, M_{5}, and M_{7} be the midpoints of sides \overline{A_{1} A_{2}}, \overline{A_{3} A_{4}}, \overline{A_{5} A_{6}}, and \overline{A_{7} A_{8}}, respectively. For i=1,3,5,7, ray R_{i} is constructed from M_{i} towards the interior of the octagon such that R_{1} \perp R_{3}, R_{3} \perp R_{5}, R_{5} \perp R_{7}, and R_{7} \perp R_{1}. Pairs of rays R_{1} and R_{3}, R_{3} and R_{5}, R_{5} and R_{7}, and R_{7} and R_{1} meet at B_{1}, B_{3}, B_{5}, and B_{7}, respectively. If B_{1} B_{3}=A_{1} A_{2}, then \cos 2 \angle A_{3} M_{3} B_{1} can be written in the form m-\sqrt{n}, where m and n are positive integers. Find m+n.