The first and the last terms of an AP are 17 and 350 respectively. If the common difference is 9, then find the number of terms in the AP and their sum.