Given a positive integer $ N $, to put

$$

mathcal {A} = {

begin {pmatrix} a & b \ c & d end {pmatrix}

: a, b, c, d in mathbb {Z} ,, , ad-bc = 4 ,, , | a |, | b |, | c |, | d | N

}

$$

and

$$

mathcal {B} = {

begin {pmatrix} a & b \ c & d end {pmatrix}

: a, b, c, d in mathbb {Z} ,, , ad-bc = 4 ,, , | a |, | b |, | c |, | d | n ,, , a, b, c, d text {are even}

}

$$

Denote $ a = # mathcal {A} $ and $ b = # mathcal {B} $. The question is how to evaluate $ a $ and $ b $ for given $ N $ (Just suppose that $ N = $ 10000) and $ lim_ {N to infty} frac {b} {a} =? $

**My attempt**

I thought that for $ mathcal {B} $ it is equivalent to calculating the number of these integer matrices whose determinant is $ 1 $. And I wanted to use Smith's normal form but I found myself stuck on how to use the condition of the variable range.

Allusions? Thanks in advance!