Let \( A = \{1,a_1,a_2,\ldots,a_{18},77\} \) be a set of integers with \( 1 < a_1 < a_2 < \ldots < a_{18} < 77 \).
Let the set \( A + A = \{ x + y : x, y \in A \} \) contain exactly \( 39 \) elements. Then, the value of \( a_1 + a_2 + \ldots + a_{18} \) is equal to ________.