If the sum of first n terms of an ap is 4n-n^2, find nth term.