import itertools

N = int(eval(input()))

s = [0] * N

not10 = []

answer = 0

for i in range(N):

    s[i] = int(eval(input()))



SUM = sum(s)

if SUM % 10 != 0:

    print(SUM)

    exit()

else:

    for i in range(N):

        if s[i] % 10 != 0:

            not10.append(s[i])

    not10.sort()

    if len(not10) == 0:

        print((0))

    else:

        print((SUM - not10[0]))

    exit()

            

# print(not10)



# for i in range(1, N+1):  # 何問正解するか、0からN問まで

#     for v in itertools.combinations(s, i):

#         if sum(v) % 10 != 0 and answer <= sum(v):

#             answer = sum(v)

#         print(v, sum(v))



# print(answer)

        
import itertools

N = int(eval(input()))

s = [0] * N

not10 = []

for i in range(N):

    s[i] = int(eval(input()))



SUM = sum(s)

if SUM % 10 != 0:

    print(SUM)

else:

    for i in range(N):

        if s[i] % 10 != 0:

            not10.append(s[i])

    not10.sort()

    if len(not10) == 0:

        print((0))

    else:

        print((SUM - not10[0]))

import itertools

N = int(eval(input()))
s = [0] * N
not10 = []
answer = 0
for i in range(N):
    s[i] = int(eval(input()))
SUM = sum(s)
if SUM % 10 != 0:
    print(SUM)
    exit()
else:
    for i in range(N):
        if s[i] % 10 != 0:
            not10.append(s[i])
    not10.sort()
    if len(not10) == 0:
        print((0))
    else:
        print((SUM - not10[0]))
    exit()
# print(not10)
# for i in range(1, N+1):  # 何問正解するか、0からN問まで
#     for v in itertools.combinations(s, i):
#         if sum(v) % 10 != 0 and answer <= sum(v):
#             answer = sum(v)
#         print(v, sum(v))
# print(answer)

import itertools

N = int(eval(input()))
s = [0] * N
not10 = []
for i in range(N):
    s[i] = int(eval(input()))
SUM = sum(s)
if SUM % 10 != 0:
    print(SUM)
else:
    for i in range(N):
        if s[i] % 10 != 0:
            not10.append(s[i])
    not10.sort()
    if len(not10) == 0:
        print((0))
    else:
        print((SUM - not10[0]))

-answer = 0 -    exit() -    exit() -# print(not10) -# for i in range(1, N+1):  # 何問正解するか、0からN問まで -#     for v in itertools.combinations(s, i): -#         if sum(v) % 10 != 0 and answer <= sum(v): -#             answer = sum(v) -#         print(v, sum(v)) -# print(answer)