A candidate is required to answer 6 out of 10 questions which is divided into two groups A and B each containing 5 questions. He is not permitted to attempt more than 4 questions from either group. Find the number of different ways in which the candidate can choose six questions.