Answer:
52
Explanation:
Suppose Joe had $J$ dollars to start with. Then Mary had $J + 2$ dollars. Since they both spent the same amount on their shirts, $\frac{2}{5} J - 1 = \frac{1}{3} (J + 2)$. Distributing, we get $\frac{2}{5} J - 1 = \frac{1}{3}J + \frac{2}{3}$. Isolating $J$ on the left side, $\frac{1}{15}J = \frac{5}{3}$. Therefore, $J = 25$. Thus, their original total amount of money was $J + (J + 2) = \boxed{52}$ dollars.