a/b sets of size c/d

sz = 3
A = (-4.063221000443456, -5.093347884700666)
a = 2 (slider from 1 to 3 * b, step 1)
b = 3 (slider from 1 to 12, step 1)
c = 4 (slider from 1 to d, step 1)
d = 5 (slider from 1 to 12, step 1)
text1: "$\frac{a}{b}=\frac{" + (LaTeX[a]) + "}{" + (LaTeX[b]) + "}$ number of sets"
text2: "The size of each set is $\frac{c}{d}=\frac{" + (LaTeX[c]) + "}{" + (LaTeX[d]) + "}$ "
A2: (x(A), y(A) + sz)
A3: (x(A) + sz, y(A) + sz)
A1: (x(A) + sz, y(A))
e = Segment(A, A1)
f = Segment(A1, A3)
g = Segment(A3, A2)
h = Segment(A2, A)
B: (x(A), y(A) + sz + 1)
C: (x(A), y(A) + 2 * sz + 2)
list1 = Sequence(Segment[(x(A) + sz * i / d, y(A)), (x(A) + sz * i / d, y(A) + sz)], i, 1, d - 1)
CD1: (x(A) + sz * c / d, y(A))
CD3: (x(A) + sz * c / d, y(A) + sz)
poly1, a_1, cd1, cd3, a2 = Polygon(A, CD1, CD3, A2)
g1: a ≥ b
g2: a ≥ 2 * b
B1: (x(B) + sz, y(B))
B2: (x(B), y(B) + sz)
B3: (x(B) + sz, y(B) + sz)
i = Segment(B, B2)
j = Segment(B2, B3)
k = Segment(B3, B1)
l = Segment(B, B1)
list2 = Sequence(Segment[(x(B) + sz * i / d, y(B)), (x(B) + sz * i / d, y(B) + sz)], i, 1, d - 1)
C3: (x(C) + sz, y(C) + sz)
C2: (x(C), y(C) + sz)
C1: (x(C) + sz, y(C))
list3 = Sequence(Segment[(x(C) + sz * i / d, y(C)), (x(C) + sz * i / d, y(C) + sz)], i, 1, d - 1)
m = Segment(C2, C)
n = Segment(C1, C)
p = Segment(C3, C2)
q = Segment(C1, C3)
list4 = Sequence(Segment[(x(C), y(C) + sz * i / b), (x(C) + sz, y(C) + sz * i / b)], i, 1, b - 1)
list5 = Sequence(Segment[(x(B), y(B) + sz * i / b), (x(B) + sz, y(B) + sz * i / b)], i, 1, b - 1)
list6 = Sequence(Segment[(x(A), y(A) + sz * i / b), (x(A) + sz, y(A) + sz * i / b)], i, 1, b - 1)
abh1 = Min(sz, sz * a / b)
abh2: g1 * Min[sz, sz * (a - b) / b]
abh3: g2 * Min[sz, sz * (a - 2 * b) / b]
Aab2: (x(A), y(A) + abh1)
Aab3: (x(A) + sz * c / d, y(A) + abh1)
poly2, a_2, cd1_1, aab3, aab2 = Polygon(A, CD1, Aab3, Aab2)
Bab1: (x(B) + c * sz / d, y(B))
Bab2: (x(B), y(B) + abh2)
Bab3: (x(B) + sz * c / d, y(B) + abh2)
poly3, b_1, bab1, bab3, bab2 = Polygon(B, Bab1, Bab3, Bab2)
Cab1: (x(C) + c * sz / d, y(C))
Cab2: (x(C), y(C) + abh3)
Cab3: (x(C) + c * sz / d, y(C) + abh3)
poly4, c_1, cab1, cab3, cab2 = Polygon(C, Cab1, Cab3, Cab2)
o = false