An AP has the form, a, a+d, a+2d, ...
The general term is a+(n-1)d.
If n=16 the 16th term is a+15d=40.
The sum of the first 5 terms is 5a+d(0+1+2+3+4)=5a+10d=5, so a+2d=1, therefore a=1-2d.
(0+1+2+3+4)=5*4/2=10=n(n-1)/2 where n=5.
Substitute for a:
1-2d+15d=40, 13d=39 so d=3 and a=1-2d=1-6=-5.
The AP is: -5, -2, 1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40, ...
Sum of the first 50 terms is 50(-5)+3(0+1+2+3+...+49)=-250+3(50)(49)/2=3425.