n=int(eval(input()))

s=[]

w=0

m=1000

for i in range(n):

    a=int(eval(input()))

    s.append(a)

    w+=a

    if a%10!=0:

        m=min(m,a)



if m==1000:

    print((0))

elif w%10!=0:

    print(w)

else:

    print((w-m))





n=int(eval(input()))

s=[]

l=[]

for i in range(n):

    p=int(eval(input()))

    s.append(p)

    if p%10!=0:

        l.append(p)

ans=sum(s)

if ans%10==0:

    if l==[]:

        print((0))

    else:

        print((ans-min(l)))

else:

    print(ans)







n = int(eval(input()))
s = []
w = 0
m = 1000
for i in range(n):
    a = int(eval(input()))
    s.append(a)
    w += a
    if a % 10 != 0:
        m = min(m, a)
if m == 1000:
    print((0))
elif w % 10 != 0:
    print(w)
else:
    print((w - m))

n = int(eval(input()))
s = []
l = []
for i in range(n):
    p = int(eval(input()))
    s.append(p)
    if p % 10 != 0:
        l.append(p)
ans = sum(s)
if ans % 10 == 0:
    if l == []:
        print((0))
    else:
        print((ans - min(l)))
else:
    print(ans)

-w = 0 -m = 1000 +l = [] -    a = int(eval(input())) -    s.append(a) -    w += a -    if a % 10 != 0: -        m = min(m, a) -if m == 1000: -    print((0)) -elif w % 10 != 0: -    print(w) +    p = int(eval(input())) +    s.append(p) +    if p % 10 != 0: +        l.append(p) +ans = sum(s) +if ans % 10 == 0: +    if l == []: +        print((0)) +    else: +        print((ans - min(l))) -    print((w - m)) +    print(ans)