Simplifying the determinant of a matrix. Suppose $$A = \begin{pmatrix} 1+a_{1}+a_{1}b_{1}+b_{2} & 1+a_{1} & 1 & 0\\ a_{2}+a_{2}b_{1}+b_{3} & 1+a_{2} & 1 & 1\\ a_{3}+a_{3}b_{1} + b_{4} & a_{3} & 1 & 1\\ a_{4} + a_{4}b_{1} & a_{4} & 0 & 1\end{pmatrix}$$ Show that $$\det(A) = \det\begin{pmatrix} b_{1}-b_{2}+b_{4} & 1+a_{1}-a_{3}+a_{4}\\ -1-b_{2}+b_{3} & a_{1}-a_{2}+a_{4}\end{pmatrix}$$

I am not sure how to show this. I tried to perform some row and column operations but could simplify matrix $A$.
Note that for a general matrix of size $(3k+1)\times (3k+1)$, the determinant of $A$ can be written in a similar form. Say for a $7 \times 7$ matrix,
$$A_{7 \times 7} = \begin{pmatrix} 1+a_1+a_1b_1+b_2 & 1+a_1 & 1& 0 &0 &0 &0\\ a_2 + a_2b_1 + b_3 & 1+a_2 & 1 & 1&0&0&0\\ a_3+a_3b_1+b_4 & a_3 & 1 & 1 & 1& 0 &0\\ a_4+a_4b_1+b_5 & a_4 & 0 & 1 & 1&1 &0\\ a_5+a_5b_1+b_6 & a_5 & 0 & 0 & 1&1 &1\\ a_6+a_6b_1+b_7 & a_6 & 0 & 0 & 0&1 &1\\ a_7 + a_7b_1 & a_7 & 0 & 0 & 0&0 &1
\end{pmatrix}$$
$$\det(A) = \det\begin{pmatrix} b_{1}-b_{2}+b_{4}-b_{5}+b_{7} & 1+a_{1}-a_{3}+a_{4}-a_{6}+a_{7}\\ -1-b_{2}+b_{3}-b_{5}+b_{6} & a_{1}-a_{2}+a_{4}-a_{5}+a_{7}\end{pmatrix}$$
Any thoughts on how to show this in general?

First, for any integer $n\geq 1$ and any numbers $A_1,...,A_n,B_1,...,B_n$ we have
$$
\det\left(I_n+\begin{pmatrix}A_1 & B_1 & 0 & \cdots &0 \\
A_2 & B_2 & 0 & \cdots &0 \\
\vdots & \vdots & \vdots & \ddots &\vdots \\
A_n & B_n & 0 & \cdots &0 \\\end{pmatrix}\right)=\det\begin{pmatrix}1+A_1 & B_1 \\ 
A_2 & 1+B_2\end{pmatrix}.
$$
The determinant under consideration (for all $n$) is
$$
\det(M+N)=\det M\cdot\det(I_n+M^{-1}N)
$$
where
$$
 M=\begin{pmatrix} 1 & 1 & 1 & 0 & \cdots &\cdots\\
 0 & 1 & 1 & 1 & \cdots&\cdots \\
 0 & 0 & 1 & 1 & \cdots&\cdots \\
 0 & 0 & 0 & 1 & \cdots&\cdots \\
\vdots & \vdots& \vdots& \vdots& \ddots&\vdots\\
0&0&0&0&\cdots&1\end{pmatrix},\quad
N=
\begin{pmatrix}
a_1(1+b_1)+b_2 & a_1 & 0 & \cdots &0 \\
a_2(1+b_1)+b_3 & a_2 & 0 & \cdots &0\\
a_3(1+b_1)+b_4 & a_3 & 0 & \cdots &0\\
\vdots & \vdots & \vdots & \ddots &\vdots\\
a_n(1+b_1)+b_{n+1} & a_n & 0 & \cdots &0
\end{pmatrix}
$$
We have $\det M=1$ and $M^{-1}$ is the matrix whose
first row is $(1,-1,0,1,-1,0,1,-1,0,...)$ and the $(k+1)$th row is obtained from the first by adding $k$ zeros to the left and truncating it to the right:
$$
M^{-1}=\begin{pmatrix}
1&-1&0&1&-1&0&\cdots\\
0&1&-1&0&1&-1&\cdots\\
0&0&1&-1&0&1&\cdots\\
0&0&0&1&-1&0&\cdots\\
0&0&0&0&1&-1&\cdots\\
0&0&0&0&0&1&\cdots\\
\vdots&\vdots&\vdots&\vdots&\vdots&\vdots&\ddots\\
0&0&0&0&0&0&\cdots&1
\end{pmatrix}
$$
By inspection, $M^{-1}N$ has the 3rd, 4th,... columns equal to the zero vector (as $N$ does so) and therefore we can apply the formula stated in the beginning to obtain
$$
\det(M+N)=\det(I_n+M^{-1}N)=\det\begin{pmatrix}1+A_1 & B_1 \\ 
A_2 & 1+B_2\end{pmatrix}
$$
with
\begin{align}
A_1&=\sum_{j=1}^n i_j(a_j(1+b_1)+b_{j+1}),&
B_1&=\sum_{j=1}^n i_ja_j,\\
A_2&=\sum_{j=1}^n i_{j-1}(a_j(1+b_1)+b_{j+1}),&
B_2&=\sum_{j=1}^n i_{j-1}a_j,
\end{align}
where we set $i_0:=0,i_1:=1,i_2:=-1$ and $i_{j+3k}:=i_j$ for all integers $k$. (To match the matrix in the original question, $b_{n+1}=0$, but the formula is valid for any value of $b_{n+1}$.)
Finally, the constraint on the remainder mod $3$ of the size is not necessary, the formula holds for all $n$.
