In a class test, the sum of Kamal's marks in mathematics and English is 40. Had he got 3 marks more in mathematics and 4 marks less in English, the product of the marks would have been 360. Find his marks in two subjects separately.