Sarah has a collection of marbles. She gave 1/3 of her marbles to her friend, Emma, and 1/4 of the remaining marbles to her brother, Tom. If she had 18 marbles left after giving some to Emma and Tom, how many marbles did Sarah originally have? Let's think step by step and output the final answer within \boxed{}.
user