The atomic mass of the elements is the weighted average of the masses of the isotopes.
This is, atomic mass = % of isotope 1 * mass number of isotope 1 + % of isotope 2 * mass number of isotope 2 + .... + % of isotpe 3 * mass number of isotope n.
Applied to our hypotethical element with 3 isotopes:
aomic mass of the element = 39.2 = 78.8% * 39 + 3.1% * 41 + 18.1% * x
Solve for x, x = [39.2 - 30.732 - 1.271] / .181 = 39.76 = 40
Answer: 40