In a certain arithmetic sequence, the sum of the first four terms is 40. If the first term is 5 and the common difference is d, find the value of d. Then, determine the sum of the first 10 terms of this sequence. Let's think step by step and output the final answer within \boxed{}.
user