A={1,a1,a2,…,a18,77} has 20 elements, and A+A has exactly 39 elements.
For any set of n elements, ∣A+A∣≥2n−1. Here n=20, so ∣A+A∣≥39. Since ∣A+A∣=39 achieves this minimum, A must be an arithmetic progression.
With 20 terms, first term 1, last term 77:
77=1+19d⟹d=1976=4
So A={1,5,9,13,…,77}, an AP with ai=1+4i for i=1,2,…,18.
a1+a2+…+a18=∑i=118(1+4i)=18+4⋅218×19=18+684=702
Hence the answer is 702.