30% of the t-shirts on a shelf are small. 40% of the remainder are large and the rest are medium. There are 240 more meduium than small t-shirts. How many t-shirts are there altogether?

t = s+m+l

m = s+240
s = .3t
l = .4(.7t)

small: 600
medium: 840
large: 560
total: 2000

check:30% of 2000 = 600
40% of (2000-600) = 560
840 = 600 + 240