Your syntax is fine, although it is more typical to consider conditional probabilities of the form P(M | X) rather than the way you've phrased it. However, you would need some extra information to solve your problem (i.e. your problem is under-constrained).
Consider a simpler case where we only have two conditions – gender and location, both of which only have two possibilities:
X={0,1} is illness state
A = {M, F} is male/female
B= {R1, R2} is region 1 or region2
Given the same set of input information we can generate several different joint probability tables.
As input data consider:
P(X=1)=0.15
P(M)=P(F)=0.5
P(R1)=0.2
P(R2)=0.8
P(X|M)=0.1,
so P(X,M)=0.1*0.5=0.05
P(X|F)=0.2,
so P(X,F)=0.2*0.5=0.1
P(X|R1)=0.5,
so P(X,R1)=0.5*0.2=0.1
P(X|R2)=1/16,
so P(X,R2)=1/16*0.8=0.05
Now consider the joint probability table when X=1. The information we have means that it must have the following form:
$$\begin{array}{c|c|c|}
X=1 & \text{M} & \text{F} & \text{Both} \\ \hline
\text{R1} & a & b & 0.1 \\ \hline
\text{R2} & c & d & 0.05\\ \hline
\text{Both} & 0.05 & 0.1 & 0.15\\ \hline
\end{array}$$
Where the entries in the table are the joint probabilities P(X=1,M,R1) etc. Note we have no more constraints to apply to the unknowns a, b, c, d. This is an under-constrained system. To see this numerically we just have to show that there are two (or more) possible tables which satisfy our constraints. For example
Joint Probability Table 1
$$\begin{array}{c|c|c|}
X=1 & \text{M} & \text{F} & \text{Both} \\ \hline
\text{R1} & 0 & 0.1 & 0.1 \\ \hline
\text{R2} & 0.05 & 0 & 0.05\\ \hline
\text{Both} & 0.05 & 0.1 & 0.15\\ \hline
\end{array}$$
Joint Probability Table 2
$$\begin{array}{c|c|c|}
X=1 & \text{M} & \text{F} & \text{Both} \\ \hline
\text{R1} & 0.05 & 0.05 & 0.1 \\ \hline
\text{R2} & 0 & 0.05 & 0.05\\ \hline
\text{Both} & 0.05 & 0.1 & 0.15\\ \hline
\end{array}$$
The reason is that P(X=1|M) gives you averaged information about males across both regions, but it doesn’t say anything about how the males with the condition are distributed across the two regions. This doesn't break independence of region and gender – there are still 50% males in each region, it’s just that in one region all of them might be healthy. Similarly for all the other expressions of the form P(X=1| ???).
TLDR – You need more information to (unambiguously) specify the probabilities you ask about.