In your case, the determinant of A is a function of a.
Here is how to solve 4x4 matrix
https://www.sophia.org/tutorials/finding-the-determinant-of-a-4x4-matrix--5
but when you encounter a, you should keep it untouched. You can still use basic algebra to keep equations simple. For example, (3*a + 4) + (4*a + 5) = 7a+9 etc.
Here is Maple doing the calculation for you:
with(LinearAlgebra):
M:=Matrix(4,[[1,4,8,1],[0,30,1,0],[0,2,0,0],[1,2,9,a]]);
Determinant(M);
-2 a + 2
What you actually need to calculate in general case of 4x4 matrices is:
M:=Matrix(4,[[a11,a12,a13,a14],[a21,a22,a23,a24],[a31,a32,a33,a34],[a41,a42,a43,a44]]);
Determinant(M);
which yields:
a11 a22 a33 a44 - a11 a22 a34 a43 - a11 a23 a32 a44 + a11 a23 a34 a42 + a11 a24 a32 a43 - a11 a24 a33 a42 - a12 a21 a33 a44 + a12 a21 a34 a43 + a12 a23 a31 a44 - a12 a23 a34 a41 - a12 a24 a31 a43 + a12 a24 a33 a41 + a13 a21 a32 a44 - a13 a21 a34 a42 - a13 a22 a31 a44 + a13 a22 a34 a41 + a13 a24 a31 a42 - a13 a24 a32 a41 - a14 a21 a32 a43 + a14 a21 a33 a42 + a14 a22 a31 a43 - a14 a22 a33 a41 - a14 a23 a31 a42 + a14 a23 a32 a41
here you can see this rule
https://en.wikipedia.org/wiki/Determinant#n.C2.A0.C3.97.C2.A0n_matrices
used.