We study N = 2 superconformal theories with gauge group SU(N) and 2N fundamental flavours in a locus of the Coulomb branch with a Z_N symmetry. In this special vacuum, we calculate the prepotential, the dual periods and the period matrix using equivariant localization. When the flavours are massless, we find that the period matrix is completely specified by [N/2] effective couplings. On each of these, we show that the S-duality group acts as a generalized triangle group and that its hauptmodul can be used to write a non-perturbatively exact relation between each effective coupling and the bare one. For N = 2, 3, 4 and 6, the generalized triangle group is an arithmetic Hecke group which contains a subgroup that is also a congruence subgroup of the modular group PSL(2,Z). For these cases, we introduce mass deformations that respect the symmetries of the special vacuum and show that the constraints arising from S-duality make it possible to resum the instanton contributions to the period matrix in terms of meromorphic modular forms which solve modular anomaly equations.