is a square of side length 1. , , and are the midpoints of , , and , respectively. The lines , , , , , , and determine a convex 8-gon. By symmetry, this octagon has equal sides. If is the side length of the octagon, then can be expressed as , where and are coprime positive integers. What is the value of ?