4. Josip painted a wooden fence around his garden. Over the weekend, he painted $12 \mathrm{~m}$ more than $\frac{3}{8}$ of the total length of the fence. On Monday, he painted $3 \mathrm{~m}$ more than $\frac{1}{4}$ of the total length of the fence, and on Tuesday, $\frac{1}{3}$ of the length he painted over the weekend and on Monday. On Wednesday, he painted the remaining part of the fence, which was exactly $\frac{1}{24}$ of the total length of the fence. How long is the fence around Josip's garden?