Mark give 20% of his marbles to john and three eighths of the remainder to harry. if he had 40 remain, how many marbles he had a first?

20% = 1/5

3/8 * 4/5 = 3/10
1/5 + 3/10 = 1/2

so, x/2 = 40
...