<|im_start|>system
You are a helpful assistant. You first think about the reasoning process in the mind and then provide the user with the answer. You should try to truely solve the question by yourself without cheating.  <|im_end|>
<|im_start|>user
 In a class of 40 students, 10 did not opt for math, 15 did not opt for science, 20 didn't opt for history, and 5 didn't opt for geography. Furthermore, 2 did not opt for either math or science, 3 did not opt for either math or history, 4 did not opt for either math or geography, 7 did not opt for either science or history, 8 did not opt for either science or geography, and 10 did not opt for either history or geography. Given this, how many students in the class opted for both math and science?
 Show your work in <think> </think> tags. And return the final answer in <answer> </answer> tags.<|im_end|>
<|im_start|>assistant
Let me solve this step by step.
<think>
user
17
In a class of 40 students, 10 did not opt for math, 15 did not opt for science, 20 didn't opt for history, and 5 didn't opt for geography. Furthermore, 2 did not opt for either math or science, 3 did not opt for either math or history, 4 did not opt for either math or geography, 7 did not opt for either science or history, 8 did not opt for either science or geography, and 10 did not opt for either history or geography. Given this, how many students in the class opted for both math and science?

test