N = int(eval(input()))

L = [int(eval(input())) for i in range(N)]

L = [0]+L

L = sorted(L)



p = sum(L)



flag = 0

while flag == 0 :

    counter = 0

    for i in range(len(L)) :

        q = p - L[i]

        if q % 10 != 0 :

            ans = q

            flag = 1

            break

        else :

            counter += 1

            if counter == len(L) :

                ans = 0

                flag = 1

                break

print(ans)

N = int(eval(input()))

L = [int(eval(input())) for i in range(N)]

L = sorted(L)

ans = sum(L)

if ans % 10 == 0 :

    for l in L :

        if l % 10 != 0 :

            ans -= l

            break

    else :

        ans = 0

print(ans)
N = int(eval(input()))
L = [int(eval(input())) for i in range(N)]
L = [0] + L
L = sorted(L)
p = sum(L)
flag = 0
while flag == 0:
    counter = 0
    for i in range(len(L)):
        q = p - L[i]
        if q % 10 != 0:
            ans = q
            flag = 1
            break
        else:
            counter += 1
            if counter == len(L):
                ans = 0
                flag = 1
                break
print(ans)

N = int(eval(input()))
L = [int(eval(input())) for i in range(N)]
L = sorted(L)
ans = sum(L)
if ans % 10 == 0:
    for l in L:
        if l % 10 != 0:
            ans -= l
            break
    else:
        ans = 0
print(ans)

-L = [0] + L -p = sum(L) -flag = 0 -while flag == 0: -    counter = 0 -    for i in range(len(L)): -        q = p - L[i] -        if q % 10 != 0: -            ans = q -            flag = 1 +ans = sum(L) +if ans % 10 == 0: +    for l in L: +        if l % 10 != 0: +            ans -= l -        else: -            counter += 1 -            if counter == len(L): -                ans = 0 -                flag = 1 -                break +    else: +        ans = 0