n = int(eval(input()))

s = sorted([int(eval(input())) for i in range(n)])



ans = 0

if sum(s) % 10 != 0:

    print((sum(s)))

else:

    for i in s:

        if i % 10 != 0:

            ans = sum(s) - i

            print(ans)

            break

    if ans == 0:

        print(ans)

n = int(eval(input()))

s = sorted([int(eval(input())) for i in range(n)])

total = sum(s)

ans = 0

if total % 10 != 0:

    print(total)

else:

    for i in s:

        if i % 10 != 0:

            ans = total - i

            break

    print((max(0, ans)))

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

n = int(eval(input()))
s = sorted([int(eval(input())) for i in range(n)])
total = sum(s)
ans = 0
if total % 10 != 0:
    print(total)
else:
    for i in s:
        if i % 10 != 0:
            ans = total - i
            break
    print((max(0, ans)))

+total = sum(s) -if sum(s) % 10 != 0: -    print((sum(s))) +if total % 10 != 0: +    print(total) -            ans = sum(s) - i -            print(ans) +            ans = total - i -    if ans == 0: -        print(ans) +    print((max(0, ans)))