Since the Sum of the A.P to "n" terms is given by :n/2×( First term + Last term)
Therefore, the The factor " (First term + last term)/2" means the middle term of the A.P. 
As the middle term of an AP having "n" terms with the first term as "a" and the common difference to be "d". =  a+[({n+1}/2)-1]d..........(eqn. 1) 
 [the middle term of an odd no. series is given by (n+1)/2 ]
Similarly, the avg. of the first and last term is given by = [a+a+(n-1)d]/2

As, Clearly seen both the terms are same equal . Therefore, the sum can be found by this ; n×(middle term) = 13×40= 520.
Hence, 520 is the answer. 
1 4 1
Can you tell me the Ap.....?????
Ap is not requried .
or u can find it by solving the two eqn. for the 7th term and the total sum. 2 equations .. 2 variables .. so u can easily find the "a" and "d" from there. hence, the AP