n = int(eval(input()))

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



sumNum = sum(s)

if sumNum % 10 != 0:

  print(sumNum)

  exit()

else:

  ans = 0

  for i in s:

    if (sumNum - i) % 10 != 0:

      ans = max(ans, sumNum - i)

  print(ans)
from itertools import combinations

n = int(eval(input()))

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



ans = sum(s)

if ans % 10 != 0: print(ans)

elif all(i%10 == 0 for i in s): print((0))

else:

  for i in range(1,n):

    for j in combinations(s,i):

      t = sum(j)

      if (ans-t)%10 != 0:

        print((ans-t))

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

from itertools import combinations

n = int(eval(input()))
s = sorted([int(eval(input())) for _ in range(n)])
ans = sum(s)
if ans % 10 != 0:
    print(ans)
elif all(i % 10 == 0 for i in s):
    print((0))
else:
    for i in range(1, n):
        for j in combinations(s, i):
            t = sum(j)
            if (ans - t) % 10 != 0:
                print((ans - t))
                exit()

+from itertools import combinations + -sumNum = sum(s) -if sumNum % 10 != 0: -    print(sumNum) -    exit() +ans = sum(s) +if ans % 10 != 0: +    print(ans) +elif all(i % 10 == 0 for i in s): +    print((0)) -    ans = 0 -    for i in s: -        if (sumNum - i) % 10 != 0: -            ans = max(ans, sumNum - i) -    print(ans) +    for i in range(1, n): +        for j in combinations(s, i): +            t = sum(j) +            if (ans - t) % 10 != 0: +                print((ans - t)) +                exit()