AMC 10A/12A 2024 (Problem 25/22)

The figure below shows a dotted grid 8 cells wide and 3 cells tall consisting of 1′′×1′′1''\times1'' squares. Carl places 1-inch toothpicks along some of the sides of the squares to create a closed loop that does not intersect itself. The numbers in the cells indicate the number of sides of that square that are to be covered by toothpicks, and any number of toothpicks are allowed if no number is written. In how many ways can Carl place the toothpicks?
Dotted grid 8 cells wide and 3 cells tall with eight 1s in the middle row
(A)  130\text{(A)}\;130(B)  144\text{(B)}\;144(C)  146\text{(C)}\;146(D)  162\text{(D)}\;162(E)  196\text{(E)}\;196