The first and the last term of an A.P. are 17 and 350 respectively. If the common difference is 9, how many terms are there and what is their sum?