Q:

Is there a formula for the determinant of a block matrix of this kind?

I am looking for an expression that gives the determinant of a matrix of the form
\begin{bmatrix} A & B & 0 & \dots & 0 & C \\
B & A & B &  & 0 & 0 \\
0 & B & A & \ddots & 0 & \vdots \\
0 &  &  & \ddots & A & B \\
C & 0 & \dots & \dots & B & A \\
\end{bmatrix}
Just to clarify. The above matrix is a block tridiagonal matrix with "extra" block entries in the "corners" of the matrix. All block entries are of the same size. They are all square matrices of the same size.
My first port of call was to recursively apply the block formula given in the following link under the heading "Block Matrices".
https://en.wikipedia.org/wiki/Determinant
The expression gets quite messy. I was wondering if there was a paper or well known formula among mathematicians which would make easy work of such a task.
Each of the blocks $A,B,C$ are tridiagonal, toeplitz matrices which are invertable. 
EDIT: attempting to implement the suggested solution given by Federico 
I can write the above matrix as
$$\mathcal{A} = \bar{\mathcal{A}} + UWV^T \in \mathbb{R}^{ml \times ml},$$ where $$U = [e_l \otimes\mathbb{I}_m,e_1 \otimes\mathbb{I}_m], W = diag(C,C), V = [e_1 \otimes\mathbb{I}_m,e_l \otimes\mathbb{I}_m]$$
and 
$$
\bar{\mathcal{A}} = 
\begin{bmatrix} A & B & &  &  & \\
B & A & B &  &  &  \\
 & B & A & \ddots &  &  \\
 &  &  & \ddots & A & B \\
 &  &  &  & B & A \\
\end{bmatrix}
$$
This allows me to say
$$\det\left(\bar{\mathcal{A}} + {UWV}^T\right) = \det (W^{-1} + V^T\bar{\mathcal{A}}^{-1}U)\det{W}\det \bar{\mathcal{A}}$$
The problem for me now is to somehow find an expression for the determinant of $\bar{\mathcal{A}}$ and the determinant of $W^{-1} + V^T\bar{\mathcal{A}}^{-1}U$.

A:

Just a sketch of an idea that seems to work:

You can get rid of the corrections $C$ using the matrix determinant lemma (or, better, replace them with $B$, which makes the matrix block circulant).
Once you have made those corrections, you can change basis using the generalized Schur decomposition and reduce to a case in which $A$ and $B$ are upper triangular.
After you have done this reduction, you can reorder the entries to obtain a block triangular matrix, in which every diagonal block is tridiagonal Toeplitz or circulant. Those matrices have explicit formulas for their determinants (and, actually, even for their eigenvalues).

